public function PathSubscriber::onKernelRequestConvertPath

Converts the request path to a system path.

Parameters

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

File

drupal/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php, line 49
Definition of Drupal\Core\EventSubscriber\PathSubscriber.

Class

PathSubscriber
Access subscriber for controller requests.

Namespace

Drupal\Core\EventSubscriber

Code

public function onKernelRequestConvertPath(GetResponseEvent $event) {
  $request = $event
    ->getRequest();
  $path = trim($request
    ->getPathInfo(), '/');
  $path = $this->pathProcessor
    ->processInbound($path, $request);
  $request->attributes
    ->set('system_path', $path);

  // Also set an attribute that indicates whether we are using clean URLs.
  $clean_urls = TRUE;
  $base_url = $request
    ->getBaseUrl();
  if (!empty($base_url) && strpos($base_url, $request
    ->getScriptName()) !== FALSE) {
    $clean_urls = FALSE;
  }
  $request->attributes
    ->set('clean_urls', $clean_urls);

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