本文整理汇总了PHP中Zend\View\Renderer\PhpRenderer::getHelperPluginManager方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpRenderer::getHelperPluginManager方法的具体用法?PHP PhpRenderer::getHelperPluginManager怎么用?PHP PhpRenderer::getHelperPluginManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\View\Renderer\PhpRenderer
的用法示例。
在下文中一共展示了PhpRenderer::getHelperPluginManager方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* @param Message $message
* @return Message
*/
public function render(Message $message)
{
$viewModel = new ViewModel($this->variables);
$viewModel->setTemplate($this->template);
$helperPluginManager = $this->renderer->getHelperPluginManager();
/** @var HeadTitle $helper */
$helper = $helperPluginManager->get('HeadTitle');
// replace headTitle
$headTitle = new HeadTitle();
$headTitle->setAutoEscape(false);
$helperPluginManager->setAllowOverride(true);
$helperPluginManager->setService('HeadTitle', $headTitle);
if (!$message->getBody()) {
$message->setBody(new MimeMessage());
}
$text = new Part($this->renderer->render($viewModel));
$text->charset = 'UTF-8';
$text->boundary = $message->getBody()->getMime()->boundary();
$text->encoding = Mime::ENCODING_BASE64;
$text->type = Mime::TYPE_HTML;
$message->getBody()->addPart($text);
$message->setSubject($headTitle->renderTitle());
// hack for ZF
$message->setBody($message->getBody());
// restore original helper
$helperPluginManager->setService('HeadTitle', $helper);
return $message;
}
示例2: setUp
protected function setUp()
{
$this->view = new PhpRenderer();
$this->view->getHelperPluginManager()->get('basePath')->setBasePath('/');
$this->helper = new Resize();
$this->helper->setView($this->view);
}
示例3: getRenderer
/**
*
* @return \Zend\View\Renderer\PhpRenderer
*/
public function getRenderer()
{
if ($this->renderer === null) {
$renderer = new PhpRenderer();
// register view helpers
$formHelperConfig = new ZendFormHelperConfig();
$formHelperConfig->configureServiceManager($renderer->getHelperPluginManager());
// register view helpers
$formHelperConfig = new FormHelperConfig();
$formHelperConfig->configureServiceManager($renderer->getHelperPluginManager());
// set base path
$path = $this->templatePath ?: __DIR__ . '/view/scripts';
$renderer->resolver()->addPath($path);
$this->setRenderer($renderer);
}
return $this->renderer;
}
示例4: testEvents
public function testEvents()
{
$application = $this->services->get('application');
$application->bootstrap();
$events = new Events();
$renderer = new PhpRenderer();
$renderer->getHelperPluginManager()->setServiceLocator($this->services);
$events->setView($renderer);
$eventManager = $application->getEventManager();
$events($eventManager);
}
示例5: getHTML
public function getHTML()
{
$this->checkForGetHTMLZendDependencies();
$html = null;
$renderer = new PhpRenderer();
$formHelperConfig = new \Zend\Form\View\HelperConfig();
$formHelperConfig->configureServiceManager($renderer->getHelperPluginManager());
$formRenderer = new \Zend\Form\View\Helper\Form();
$html .= $formRenderer->openTag($this->form);
$formRow = new \Zend\Form\View\Helper\FormRow();
$formRow->setView($renderer);
foreach ($this->form->getElements() as $key => $element) {
$html .= '<div id="' . $key . '" class="element">';
$html .= $formRow->render($element);
$html .= '</div>' . PHP_EOL;
}
$html .= $formRenderer->closeTag();
return $html;
}
示例6: loadControler
public static function loadControler($template)
{
global $view;
$template_name = ucfirst(str_replace('.php', '', basename($template)));
$template_name = ucwords(str_replace('-', ' ', $template_name));
$template_name = str_replace(' ', '', $template_name);
$controller_name = 'Bundle\\FrontBundle\\Controller\\' . $template_name . 'Controller';
$render = new PhpRenderer();
$plugins = $render->getHelperPluginManager();
$config = new HelperConfig();
$config->configureServiceManager($plugins);
if (class_exists($controller_name)) {
$controller = new $controller_name();
$vars = $controller->init();
$vars['render'] = $render;
$view = new ViewModel($vars);
}
return $template;
}
示例7: initRenderer
/**
* Init renderer object
*/
protected function initRenderer()
{
$renderer = new PhpRenderer();
$plugins = $renderer->getHelperPluginManager();
$config = new \Zend\Form\View\HelperConfig();
$config->configureServiceManager($plugins);
$resolver = new Resolver\AggregateResolver();
$map = new Resolver\TemplateMapResolver($this->getTable()->getOptions()->getTemplateMap());
$resolver->attach($map);
$renderer->setResolver($resolver);
$this->renderer = $renderer;
}