/** * An event hook is attached to the `action` event of the controller for late rendering, * which only happens if the response is `null`. * * @param Controller $controller The controller that invoked the view. * @param Renderer $renderer */ public function __construct(Controller $controller, Renderer $renderer) { $this->controller = $controller; $this->renderer = $renderer; $this['view'] = $this; EventCollectionProvider::provide()->attach_to($controller, function (Controller\ActionEvent $event, Controller $target) { $this->on_action($event); }); }