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

 Methods

Attach one or more listeners

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

Implementors may add an optional $priority argument; the EventManager implementation will pass this to the aggregate.

Parameters

Detach aggregate listeners from the specified event manager

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

Instantiates and configures the exception strategy

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

Instantiates and configures the renderer's helper manager

getHelperManager() : \Zend\View\HelperPluginManager

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

Instantiates and configures the renderer

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

Instantiates and configures the renderer strategy for the view

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

Instantiates and configures the renderer's resolver

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

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

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

Instantiates and configures the view

getView() : \Zend\View\View

Returns

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

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

Prepares the view layer

onBootstrap($event) : void

Parameters

$event

Register additional mvc rendering strategies

registerMvcRenderingStrategies(\Zend\EventManager\EventManagerInterface $events) 

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

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

 

<p>application configuration service</p>

$config : object

 

$event

$event : \Zend\Mvc\MvcEvent

 

$exceptionStrategy

$exceptionStrategy 

 

$helperManager

$helperManager 

 

$listeners

$listeners : \Zend\Stdlib\CallbackHandler[]
Inherited

inherited_from \Zend\EventManager\AbstractListenerAggregate::$$listeners
 

$mvcRenderingStrategy

$mvcRenderingStrategy 

 

$renderer

$renderer 

 

$rendererStrategy

$rendererStrategy 

 

$resolver

$resolver 

 

$routeNotFoundStrategy

$routeNotFoundStrategy 

 

$services

$services : \Zend\ServiceManager\ServiceManager

 

$view

$view 

 

$viewModel

$viewModel