Prepares the view layer for console applications

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\Mvc\View\Http\ViewManager

 Methods

{@inheritDoc}

attach(\Zend\EventManager\EventManagerInterface $events) 
Inherited

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\Console\ExceptionStrategy

Overriding to ensure we pick up the exception strategy for console, as well as to ensure that the appropriate aliases are set.

inherited_from \Zend\Mvc\View\Http\ViewManager::getExceptionStrategy()

Returns

\Zend\Mvc\View\Console\ExceptionStrategy

Instantiates and configures the exception strategy

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

Returns

\Zend\Mvc\View\Http\ExceptionStrategy

Instantiates and configures the renderer's helper manager

getHelperManager() : \Zend\View\HelperPluginManager
Inherited

Returns

\Zend\View\HelperPluginManager

getInjectTemplateListener()

getInjectTemplateListener() 
Inherited

Retrieves the layout template name from the configuration

getLayoutTemplate() : string
Inherited

Returns

string

Instantiates and configures the default MVC rendering strategy

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

Overriding to ensure we pick up the MVC rendering strategy for console, as well as to ensure that the appropriate aliases are set.

inherited_from \Zend\Mvc\View\Http\ViewManager::getMvcRenderingStrategy()

Returns

\Zend\Mvc\View\Console\DefaultRenderingStrategy

Instantiates and configures the default MVC rendering strategy

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

Returns

\Zend\Mvc\View\Http\DefaultRenderingStrategy

Instantiates and configures the renderer

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

Returns

\Zend\View\Renderer\PhpRenderer

Instantiates and configures the renderer strategy for the view

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

Returns

\Zend\View\Strategy\PhpRendererStrategy

Instantiates and configures the renderer's resolver

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

Returns

\Zend\View\Resolver\ResolverInterface

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

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

Overriding to ensure we pick up the route not found strategy for console, as well as to ensure that the appropriate aliases are set.

inherited_from \Zend\Mvc\View\Http\ViewManager::getRouteNotFoundStrategy()

Returns

\Zend\Mvc\View\Console\RouteNotFoundStrategy

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

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

Returns

\Zend\Mvc\View\Http\RouteNotFoundStrategy

Instantiates and configures the view

getView() : \Zend\View\View
Inherited

Returns

\Zend\View\View

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

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

Returns

\Zend\View\Model\ModelInterface

Prepares the view layer

onBootstrap(\Zend\Mvc\MvcEvent $event) : void

Overriding, as several operations are omitted in the console view algorithms, as well as to ensure we pick up the Console variants of several listeners and strategies.

inherited_from \Zend\Mvc\View\Http\ViewManager::onBootstrap()

Parameters

$event

\Zend\Mvc\MvcEvent

Prepares the view layer

onBootstrap($event) : void
Inherited

Parameters

$event

Register additional mvc rendering strategies

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

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
Inherited

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.

Extract view manager configuration from the application's configuration

loadConfig(array|\ArrayAccess $configService) : array

Parameters

$configService

array\ArrayAccess

Returns

array

 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