The view layer of Zend Framework 2 incorporates and utilizes a custom Zend\EventManager\Event implementation - Zend\View\ViewEvent. This event is created during Zend\View\View::getEvent() and is passed directly to all the events that method triggers.
The ViewEvent adds accessors and mutators for the following:
The methods it defines are:
The following events are triggered, in the following order:
Name | Constant | Description |
---|---|---|
renderer | ViewEvent::EVENT_RENDERER | Render the view, with the help of renderers. |
renderer.post | ViewEvent::EVENT_RENDERER_POST | Triggers after the view is rendered. |
response | ViewEvent::EVENT_RESPONSE | Populate the response from the view. |
Those events are extensively describe in the following sections.
The following classes are listening to this event (they are sorted from higher priority to lower priority):
This listener is added when the strategy used for rendering is PhpStrategy:
Class | Priority | Method Called | Description |
---|---|---|---|
Zend\View\Strategy\PhpStrategy | 1 | selectRenderer | Return a PhpRenderer |
This listener is added when the strategy used for rendering is JsonStrategy:
Class | Priority | Method Called | Description |
---|---|---|---|
Zend\View\Strategy\JsonStrategy | 1 | selectRenderer | Return a JsonRenderer |
This listener is added when the strategy used for rendering is FeedStrategy:
Class | Priority | Method Called | Description |
---|---|---|---|
Zend\View\Strategy\FeedStrategy | 1 | selectRenderer | Return a FeedRenderer |
This event is triggered by the following classes:
Class | In Method | Description |
---|---|---|
Zend\View\View | render | It has a short circuit callback that stops propagation once one result return an instance of a Renderer. |
There are currently no built-in listeners for this event.
This event is triggered by the following classes:
Class | In Method | Description |
---|---|---|
Zend\View\View | render | This event is triggered after ViewEvent::EVENT_RENDERER and before ViewEvent::EVENT_RESPONSE. |
The following classes are listening to this event (they are sorted from higher priority to lower priority):
This listener is added when the strategy used for rendering is PhpStrategy:
Class | Priority | Method Called | Description |
---|---|---|---|
Zend\View\Strategy\PhpStrategy | 1 | injectResponse | Populate the Response object from the view. |
This listener is added when the strategy used for rendering is JsonStrategy:
Class | Priority | Method Called | Description |
---|---|---|---|
Zend\View\Strategy\JsonStrategy | 1 | injectResponse | Populate the Response object from the view. |
This listener is added when the strategy used for rendering is FeedStrategy:
Class | Priority | Method Called | Description |
---|---|---|---|
Zend\View\Strategy\FeedStrategy | 1 | injectResponse | Populate the Response object from the view. |
This event is triggered by the following classes:
Class | In Method | Description |
---|---|---|
Zend\View\View | render | This event is triggered after ViewEvent::EVENT_RENDERER and ViewEvent::EVENT_RENDERER_POST. |
The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.