Prepares the view layer

Instantiates and configures all classes related to the view layer, including the renderer (and its associated resolver(s) and helper manager), the view object (and its associated rendering strategies), and the various MVC strategies and listeners.

Defines and manages the following services:

  • ViewHelperManager (also aliased to Zend\View\HelperPluginManager)
  • ViewTemplateMapResolver (also aliased to Zend\View\Resolver\TemplateMapResolver)
  • ViewTemplatePathStack (also aliased to Zend\View\Resolver\TemplatePathStack)
  • ViewResolver (also aliased to Zend\View\Resolver\AggregateResolver and ResolverInterface)
  • ViewRenderer (also aliased to Zend\View\Renderer\PhpRenderer and RendererInterface)
  • ViewPhpRendererStrategy (also aliased to Zend\View\Strategy\PhpRendererStrategy)
  • View (also aliased to Zend\View\View)
  • DefaultRenderingStrategy (also aliased to Zend\Mvc\View\Http\DefaultRenderingStrategy)
  • ExceptionStrategy (also aliased to Zend\Mvc\View\Http\ExceptionStrategy)
  • RouteNotFoundStrategy (also aliased to Zend\Mvc\View\Http\RouteNotFoundStrategy and 404Strategy)
  • ViewModel
package Default
inherited_from \Zend\EventManager\AbstractListenerAggregate

 Methods

{@inheritDoc}

attach(\Zend\EventManager\EventManagerInterface $events) 

Parameters

$events

Detach all previously attached listeners

detach(\Zend\EventManager\EventManagerInterface $events) 
Inherited
inherited_from \Zend\EventManager\ListenerAggregateInterface::detach()

Parameters

$events

Instantiates and configures the exception strategy

getExceptionStrategy() : \Zend\Mvc\View\Http\ExceptionStrategy

Returns

\Zend\Mvc\View\Http\ExceptionStrategy

Instantiates and configures the renderer's helper manager

getHelperManager() : \Zend\View\HelperPluginManager

Returns

\Zend\View\HelperPluginManager

getInjectTemplateListener()

getInjectTemplateListener() 

Retrieves the layout template name from the configuration

getLayoutTemplate() : string

Returns

string

Instantiates and configures the default MVC rendering strategy

getMvcRenderingStrategy() : \Zend\Mvc\View\Http\DefaultRenderingStrategy

Returns

\Zend\Mvc\View\Http\DefaultRenderingStrategy

Instantiates and configures the renderer

getRenderer() : \Zend\View\Renderer\PhpRenderer

Returns

\Zend\View\Renderer\PhpRenderer

Instantiates and configures the renderer strategy for the view

getRendererStrategy() : \Zend\View\Strategy\PhpRendererStrategy

Returns

\Zend\View\Strategy\PhpRendererStrategy

Instantiates and configures the renderer's resolver

getResolver() : \Zend\View\Resolver\ResolverInterface

Returns

\Zend\View\Resolver\ResolverInterface

Instantiates and configures the "route not found", or 404, strategy

getRouteNotFoundStrategy() : \Zend\Mvc\View\Http\RouteNotFoundStrategy

Returns

\Zend\Mvc\View\Http\RouteNotFoundStrategy

Instantiates and configures the view

getView() : \Zend\View\View

Returns

\Zend\View\View

Configures the MvcEvent view model to ensure it has the template injected

getViewModel() : \Zend\View\Model\ModelInterface

Returns

\Zend\View\Model\ModelInterface

Prepares the view layer

onBootstrap($event) : void

Parameters

$event

Register additional mvc rendering strategies

registerMvcRenderingStrategies(\Zend\EventManager\EventManagerInterface $events) : void

If there is a "mvc_strategies" key of the view manager configuration, loop through it. Pull each as a service from the service manager, and, if it is a ListenerAggregate, attach it to the view, at priority 100. This latter allows each to trigger before the default mvc rendering strategy, and for them to trigger in the order they are registered.

Parameters

$events

\Zend\EventManager\EventManagerInterface

Register additional view strategies

registerViewStrategies() : void

If there is a "strategies" key of the view manager configuration, loop through it. Pull each as a service from the service manager, and, if it is a ListenerAggregate, attach it to the view, at priority 100. This latter allows each to trigger before the default strategy, and for them to trigger in the order they are registered.

 Properties

 

application configuration service

$config : object

Default

 

$event

$event : \Zend\Mvc\MvcEvent

Default

 

$exceptionStrategy

$exceptionStrategy 

Default

 

$helperManager

$helperManager 

Default

 

$listeners

$listeners : array<mixed,\Zend\Stdlib\CallbackHandler>

Default

array()
 

$mvcRenderingStrategy

$mvcRenderingStrategy 

Default

 

$renderer

$renderer 

Default

 

$rendererStrategy

$rendererStrategy 

Default

 

$resolver

$resolver 

Default

 

$routeNotFoundStrategy

$routeNotFoundStrategy 

Default

 

$services

$services : \Zend\ServiceManager\ServiceManager

Default

 

$view

$view 

Default

 

$viewModel

$viewModel 

Default