eZPublishCommunityProject  2013.4
eZ\Publish\Core\MVC\Symfony\Event\PreContentViewEvent Class Reference

The PreContentViewEvent allows you to inject additional parameters to a content view template. More...

+ Inheritance diagram for eZ\Publish\Core\MVC\Symfony\Event\PreContentViewEvent:
+ Collaboration diagram for eZ\Publish\Core\MVC\Symfony\Event\PreContentViewEvent:

Public Member Functions

 __construct (ContentViewInterface $contentView)
 
 getContentView ()
 

Private Attributes

 $contentView
 

Detailed Description

The PreContentViewEvent allows you to inject additional parameters to a content view template.

To do this, get the ContentView object and add it what you need as params :

$contentView = $event->getContentView(); // Returns the location when applicable (viewing a location basically) if ( $contentView->hasParameter( 'location' ) ) $location = $contentView->getParameter( 'location' );

// Content is always available. $content = $contentView->getParameter( 'content' );

// Set your own variables that will be exposed in the template // The following will expose "foo" and "complex" variables in the view template. $contentView->addParameters( array( 'foo' => 'bar', 'complex' => $someObject ) );

Constructor & Destructor Documentation

eZ\Publish\Core\MVC\Symfony\Event\PreContentViewEvent::__construct ( ContentViewInterface  $contentView)

Member Function Documentation

eZ\Publish\Core\MVC\Symfony\Event\PreContentViewEvent::getContentView ( )
Returns

Member Data Documentation

eZ\Publish\Core\MVC\Symfony\Event\PreContentViewEvent::$contentView
private

The documentation for this class was generated from the following file: