PHP Class Zend\Mvc\View\Http\ViewManager

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 and ViewHelperBroker) - 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
Inheritance: implements Zend\EventManager\ListenerAggregateInterface
Show file Open project: zendframework/zend-mvc

Protected Properties

Property Type Description
$config application configuration service
$event Zend\Mvc\MvcEvent
$helperManager
$mvcRenderingStrategy
$renderer
$rendererStrategy
$resolver
$services Zend\ServiceManager\ServiceManager
$view
$viewModel

Public Methods

Method Description
attach ( Zend\EventManager\EventManagerInterface $events, $priority = 1 ) {@inheritDoc}
getView ( ) : Zend\View\View Retrieves the View instance
getViewModel ( ) : Zend\View\Model\ModelInterface Configures the MvcEvent view model to ensure it has the template injected
onBootstrap ( $event ) : void Prepares the view layer

Protected Methods

Method Description
registerMvcRenderingStrategies ( Zend\EventManager\EventManagerInterface $events ) : void Register additional mvc rendering strategies
registerViewStrategies ( ) : void Register additional view strategies

Private Methods

Method Description
injectViewModelIntoPlugin ( ) Injects the ViewModel view helper with the root view model.

Method Details

attach() public method

{@inheritDoc}
public attach ( Zend\EventManager\EventManagerInterface $events, $priority = 1 )
$events Zend\EventManager\EventManagerInterface

getView() public method

Retrieves the View instance
public getView ( ) : Zend\View\View
return Zend\View\View

getViewModel() public method

Configures the MvcEvent view model to ensure it has the template injected
public getViewModel ( ) : Zend\View\Model\ModelInterface
return Zend\View\Model\ModelInterface

onBootstrap() public method

Prepares the view layer
public onBootstrap ( $event ) : void
$event
return void

registerMvcRenderingStrategies() protected method

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.
protected registerMvcRenderingStrategies ( Zend\EventManager\EventManagerInterface $events ) : void
$events Zend\EventManager\EventManagerInterface
return void

registerViewStrategies() protected method

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.
protected registerViewStrategies ( ) : void
return void

Property Details

$config protected property

application configuration service
protected $config

$event protected property

protected MvcEvent,Zend\Mvc $event
return Zend\Mvc\MvcEvent

$helperManager protected property

protected $helperManager

$mvcRenderingStrategy protected property

protected $mvcRenderingStrategy

$renderer protected property

protected $renderer

$rendererStrategy protected property

protected $rendererStrategy

$resolver protected property

protected $resolver

$services protected property

protected ServiceManager,Zend\ServiceManager $services
return Zend\ServiceManager\ServiceManager

$view protected property

protected $view

$viewModel protected property

protected $viewModel