public getContentView ( ) : eZ\Publish\Core\MVC\Symfony\View\View | ||
return | eZ\Publish\Core\MVC\Symfony\View\View |
public function onPreContentView( PreContentViewEvent $event ) { $contentView = $event->getContentView(); $contentView->addParameters( array( 'foo' => 'bar', 'osTypes' => array( 'osx', 'linux', 'win' ) ) ); }
/** * If the event's view has a defined template, sets the view's template identifier, * and the 'pagelayout' parameter. * * @param PreContentViewEvent $event */ public function setUserRegistrationTemplates(PreContentViewEvent $event) { $view = $event->getContentView(); foreach ($this->viewTemplates as $viewClass => $template) { if ($view instanceof $viewClass) { $view->setTemplateIdentifier($template); $view->addParameters(['pagelayout' => $this->pagelayout]); } } }
/** * @param PreContentViewEvent $event */ public function onPreContentView(PreContentViewEvent $event) { $contentView = $event->getContentView(); /** @var \Truffo\eZContentDecoratorBundle\Decorator\ContentDecoratorFactory $contentDecoratorFactory */ $contentDecoratorFactory = $this->container->get('ezcontentdecorator.services.factory'); if ($contentView->hasParameter('location')) { $location = $contentView->getParameter('location'); /** @var \Truffo\eZContentDecoratorBundle\Decorator\ContentDecorator $contentDecorator */ $contentDecorator = $contentDecoratorFactory->getContentDecorator($location); $contentView->addParameters([$contentDecorator->getContentTypeIdentifier() => $contentDecorator, 'decorator' => $contentDecorator]); } }