protected function UrlGenerator::processPath

protected UrlGenerator::processPath($path, &$options = array(), BubbleableMetadata $bubbleable_metadata = NULL)

Passes the path to a processor manager to allow alterations.

File

core/lib/Drupal/Core/Routing/UrlGenerator.php, line 374

Class

UrlGenerator
Generates URLs from route names and parameters.

Namespace

Drupal\Core\Routing

Code

protected function processPath($path, &$options = array(), BubbleableMetadata $bubbleable_metadata = NULL) {
  // Router-based paths may have a querystring on them.
  if ($query_pos = strpos($path, '?')) {
    // We don't need to do a strict check here because position 0 would mean we
    // have no actual path to work with.
    $actual_path = substr($path, 0, $query_pos);
    $query_string = substr($path, $query_pos);
  }
  else {
    $actual_path = $path;
    $query_string = '';
  }
  $path = $this->pathProcessor->processOutbound($actual_path === '/' ? $actual_path : rtrim($actual_path, '/'), $options, $this->requestStack->getCurrentRequest(), $bubbleable_metadata);
  $path .= $query_string;
  return $path;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Routing!UrlGenerator.php/function/UrlGenerator::processPath/8.1.x