W3cubDocs

/Drupal 8

protected function UrlGenerator::getInternalPathFromRoute

protected UrlGenerator::getInternalPathFromRoute($name, SymfonyRoute $route, $parameters = array(), $query_params = array())

Gets the path of a route.

Parameters

$name: The route name or other debug message.

\Symfony\Component\Routing\Route $route: The route object.

array $parameters: An array of parameters as passed to \Symfony\Component\Routing\Generator\UrlGeneratorInterface::generate().

array $query_params: An array of query string parameter, which will get any extra values from $parameters merged in.

Return value

string The url path corresponding to the route, without the base path.

File

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

Class

UrlGenerator
Generates URLs from route names and parameters.

Namespace

Drupal\Core\Routing

Code

protected function getInternalPathFromRoute($name, SymfonyRoute $route, $parameters = array(), $query_params = array()) {
  // The Route has a cache of its own and is not recompiled as long as it does
  // not get modified.
  $compiledRoute = $route->compile();

  return $this->doGenerate($compiledRoute->getVariables(), $route->getDefaults(), $compiledRoute->getTokens(), $parameters, $query_params, $name);
}

© 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::getInternalPathFromRoute/8.1.x