You are here

public function EarlyRenderingControllerWrapperSubscriber::onController in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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\FilterControllerEvent $event: The controller event.

File

core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php, line 95
Contains \Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.

Class

EarlyRenderingControllerWrapperSubscriber
Subscriber that wraps controllers, to handle early rendering.

Namespace

Drupal\Core\EventSubscriber

Code

public function onController(FilterControllerEvent $event) {
  $controller = $event
    ->getController();

  // See \Symfony\Component\HttpKernel\HttpKernel::handleRaw().
  $arguments = $this->controllerResolver
    ->getArguments($event
    ->getRequest(), $controller);
  $event
    ->setController(function () use ($controller, $arguments) {
    return $this
      ->wrapControllerExecutionInRenderContext($controller, $arguments);
  });
}