function PathAliasSubscriber::onKernelController

Same name in other branches
  1. 9 core/modules/path_alias/src/EventSubscriber/PathAliasSubscriber.php \Drupal\path_alias\EventSubscriber\PathAliasSubscriber::onKernelController()
  2. 10 core/modules/path_alias/src/EventSubscriber/PathAliasSubscriber.php \Drupal\path_alias\EventSubscriber\PathAliasSubscriber::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\ControllerEvent $event: The Event to process.

File

core/modules/path_alias/src/EventSubscriber/PathAliasSubscriber.php, line 52

Class

PathAliasSubscriber
Provides a path subscriber that converts path aliases.

Namespace

Drupal\path_alias\EventSubscriber

Code

public function onKernelController(ControllerEvent $event) {
    // Set the cache key on the alias manager cache decorator.
    if ($event->isMainRequest()) {
        $this->aliasManager
            ->setCacheKey(rtrim($this->currentPath
            ->getPath($event->getRequest()), '/'));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.