You are here

public function PathSubscriber::onKernelController in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php \Drupal\Core\EventSubscriber\PathSubscriber::onKernelController()

Sets the cache key on the alias manager cache decorator.

KernelEvents::CONTROLLER is used in order to be executed after routing.

Parameters

\Symfony\Component\HttpKernel\Event\FilterControllerEvent $event: The Event to process.

File

core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php, line 58
Contains \Drupal\Core\EventSubscriber\PathSubscriber.

Class

PathSubscriber
Provides a path subscriber that converts path aliases.

Namespace

Drupal\Core\EventSubscriber

Code

public function onKernelController(FilterControllerEvent $event) {

  // Set the cache key on the alias manager cache decorator.
  if ($event
    ->getRequestType() == HttpKernelInterface::MASTER_REQUEST) {
    $this->aliasManager
      ->setCacheKey(rtrim($this->currentPath
      ->getPath($event
      ->getRequest()), '/'));
  }
}