function UrlGenerator::getPathFromRoute
Same name in other branches
- 9 core/lib/Drupal/Core/Routing/UrlGenerator.php \Drupal\Core\Routing\UrlGenerator::getPathFromRoute()
- 8.9.x core/lib/Drupal/Core/Routing/UrlGenerator.php \Drupal\Core\Routing\UrlGenerator::getPathFromRoute()
- 10 core/lib/Drupal/Core/Routing/UrlGenerator.php \Drupal\Core\Routing\UrlGenerator::getPathFromRoute()
Overrides UrlGeneratorInterface::getPathFromRoute
File
-
core/
lib/ Drupal/ Core/ Routing/ UrlGenerator.php, line 128
Class
- UrlGenerator
- Generates URLs from route names and parameters.
Namespace
Drupal\Core\RoutingCode
public function getPathFromRoute(string $name, array $parameters = []) {
$route = $this->getRoute($name);
$this->processRoute($name, $route, $parameters);
$path = $this->getInternalPathFromRoute($name, $route, $parameters);
// Router-based paths may have a querystring on them but Drupal paths may
// not have one, so remove any ? and anything after it. For generate() this
// is handled in processPath().
$path = preg_replace('/\\?.*/', '', $path);
return trim($path, '/');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.