eZPublishCommunityProject  2012.12
eZ\Publish\Core\MVC\Symfony\View\Manager Class Reference

Public Member Functions

 __construct (EngineInterface $templateEngine, EventDispatcherInterface $eventDispatcher, Repository $repository, $viewBaseLayout, LoggerInterface $logger=null)
 
 addContentViewProvider (ContentViewProvider $viewProvider, $priority=0)
 Registers $viewProvider as a valid content view provider. More...
 
 addLocationViewProvider (LocationViewProvider $viewProvider, $priority=0)
 Registers $viewProvider as a valid location view provider. More...
 
 getAllContentViewProviders ()
 
 getAllLocationViewProviders ()
 
 renderContent (Content $content, $viewType=self::VIEW_TYPE_FULL, $parameters=array())
 Renders $content by selecting the right template. More...
 
 renderContentView (ContentViewInterface $view, array $defaultParams=array())
 Renders passed ContentView object via the template engine. More...
 
 renderLocation (Location $location, $viewType=self::VIEW_TYPE_FULL, $parameters=array())
 Renders $location by selecting the right template for $viewType. More...
 

Public Attributes

const VIEW_TYPE_FULL = 'full'
 
const VIEW_TYPE_LINE = 'line'
 

Protected Member Functions

 sortViewProviders ($property)
 Sort the registered view providers by priority. More...
 

Protected Attributes

 $contentViewProviders = array()
 
 $eventDispatcher
 
 $locationViewProviders = array()
 
 $logger
 
 $repository
 
 $sortedContentViewProviders
 
 $sortedLocationViewProviders
 
 $templateEngine
 
 $viewBaseLayout
 

Private Member Functions

 addViewProvider (&$property, $viewProvider, $priority)
 Helper for {. More...
 

Constructor & Destructor Documentation

eZ\Publish\Core\MVC\Symfony\View\Manager::__construct ( EngineInterface  $templateEngine,
EventDispatcherInterface  $eventDispatcher,
Repository  $repository,
  $viewBaseLayout,
LoggerInterface  $logger = null 
)

Member Function Documentation

eZ\Publish\Core\MVC\Symfony\View\Manager::addContentViewProvider ( ContentViewProvider  $viewProvider,
  $priority = 0 
)

Registers $viewProvider as a valid content view provider.

When this view provider will be called in the chain depends on $priority. The highest $priority is, the earliest the router will be called.

Parameters
\eZ\Publish\Core\MVC\Symfony\View\Provider\Content$viewProvider
int$priority
eZ\Publish\Core\MVC\Symfony\View\Manager::addLocationViewProvider ( LocationViewProvider  $viewProvider,
  $priority = 0 
)

Registers $viewProvider as a valid location view provider.

When this view provider will be called in the chain depends on $priority. The highest $priority is, the earliest the router will be called.

Parameters
\eZ\Publish\Core\MVC\Symfony\View\Provider\Location$viewProvider
int$priority
eZ\Publish\Core\MVC\Symfony\View\Manager::addViewProvider ( $property,
  $viewProvider,
  $priority 
)
private

Helper for {.

See Also
addContentViewProvider()} and {
addLocationViewProvider()}
Parameters
array$property
\eZ\Publish\Core\MVC\Symfony\View\Provider\Content$viewProvider
int$priority

Referenced by eZ\Publish\Core\MVC\Symfony\View\Manager\addContentViewProvider(), and eZ\Publish\Core\MVC\Symfony\View\Manager\addLocationViewProvider().

eZ\Publish\Core\MVC\Symfony\View\Manager::getAllContentViewProviders ( )
eZ\Publish\Core\MVC\Symfony\View\Manager::getAllLocationViewProviders ( )
eZ\Publish\Core\MVC\Symfony\View\Manager::renderContent ( Content  $content,
  $viewType = self::VIEW_TYPE_FULL,
  $parameters = array() 
)

Renders $content by selecting the right template.

$content will be injected in the selected template.

Parameters
\eZ\Publish\API\Repository\Values\Content\Content$content
string$viewTypeVariation of display for your content. Default is 'full'.
array$parametersParameters to pass to the template called to render the view. By default, it's empty. 'content' entry is reserved for the Content that is rendered.
Exceptions
\RuntimeException
Returns
string
eZ\Publish\Core\MVC\Symfony\View\Manager::renderContentView ( ContentViewInterface  $view,
array  $defaultParams = array() 
)

Renders passed ContentView object via the template engine.

If $view's template identifier is a closure, then it is called directly and the result is returned as is.

Parameters
\eZ\Publish\Core\MVC\Symfony\View\ContentViewInterface$view
array$defaultParams
Returns
string

Referenced by eZ\Publish\Core\MVC\Symfony\View\Manager\renderContent(), and eZ\Publish\Core\MVC\Symfony\View\Manager\renderLocation().

eZ\Publish\Core\MVC\Symfony\View\Manager::renderLocation ( Location  $location,
  $viewType = self::VIEW_TYPE_FULL,
  $parameters = array() 
)

Renders $location by selecting the right template for $viewType.

$content and $location will be injected in the selected template.

Parameters
\eZ\Publish\API\Repository\Values\Content\Location$location
string$viewTypeVariation of display for your content. Default is 'full'.
array$parametersParameters to pass to the template called to render the view. By default, it's empty. 'location' and 'content' entries are reserved for the Location (and its Content) that is viewed.
Exceptions
\RuntimeException
Returns
string
eZ\Publish\Core\MVC\Symfony\View\Manager::sortViewProviders (   $property)
protected

Sort the registered view providers by priority.

The highest priority number is the highest priority (reverse sorting)

Returns
[]|[]

Referenced by eZ\Publish\Core\MVC\Symfony\View\Manager\getAllContentViewProviders(), and eZ\Publish\Core\MVC\Symfony\View\Manager\getAllLocationViewProviders().

Member Data Documentation

eZ\Publish\Core\MVC\Symfony\View\Manager::$contentViewProviders = array()
protected
eZ\Publish\Core\MVC\Symfony\View\Manager::$eventDispatcher
protected
eZ\Publish\Core\MVC\Symfony\View\Manager::$locationViewProviders = array()
protected
eZ\Publish\Core\MVC\Symfony\View\Manager::$logger
protected
eZ\Publish\Core\MVC\Symfony\View\Manager::$repository
protected
eZ\Publish\Core\MVC\Symfony\View\Manager::$sortedContentViewProviders
protected
eZ\Publish\Core\MVC\Symfony\View\Manager::$sortedLocationViewProviders
protected
eZ\Publish\Core\MVC\Symfony\View\Manager::$templateEngine
protected
eZ\Publish\Core\MVC\Symfony\View\Manager::$viewBaseLayout
protected
const eZ\Publish\Core\MVC\Symfony\View\Manager::VIEW_TYPE_FULL = 'full'
const eZ\Publish\Core\MVC\Symfony\View\Manager::VIEW_TYPE_LINE = 'line'

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