function EarlyRenderingControllerWrapperSubscriber::onController
Same name in other branches
- 9 core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php \Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController()
- 8.9.x core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php \Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController()
- 11.x core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php \Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController()
Ensures bubbleable metadata from early rendering is not lost.
Parameters
\Symfony\Component\HttpKernel\Event\ControllerEvent $event: The controller event.
File
-
core/
lib/ Drupal/ Core/ EventSubscriber/ EarlyRenderingControllerWrapperSubscriber.php, line 90
Class
- EarlyRenderingControllerWrapperSubscriber
- Subscriber that wraps controllers, to handle early rendering.
Namespace
Drupal\Core\EventSubscriberCode
public function onController(ControllerEvent $event) {
$controller = $event->getController();
// See \Symfony\Component\HttpKernel\HttpKernel::handleRaw().
$arguments = $this->argumentResolver
->getArguments($event->getRequest(), $controller);
$event->setController(function () use ($controller, $arguments) {
return $this->wrapControllerExecutionInRenderContext($controller, $arguments);
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.