You are here

protected function UrlGenerator::getInternalPathFromRoute in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Routing/UrlGenerator.php \Drupal\Core\Routing\UrlGenerator::getInternalPathFromRoute()

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, not URL encoded.

2 calls to UrlGenerator::getInternalPathFromRoute()
UrlGenerator::generateFromRoute in core/lib/Drupal/Core/Routing/UrlGenerator.php
Generates a URL or path for a specific route based on the given parameters.
UrlGenerator::getPathFromRoute in core/lib/Drupal/Core/Routing/UrlGenerator.php
Gets the internal path (system path) for a route.
1 method overrides UrlGenerator::getInternalPathFromRoute()
NullGenerator::getInternalPathFromRoute in core/lib/Drupal/Core/Routing/NullGenerator.php
Gets the path of a route.

File

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

Class

UrlGenerator
Generates URLs from route names and parameters.

Namespace

Drupal\Core\Routing

Code

protected function getInternalPathFromRoute($name, SymfonyRoute $route, $parameters = [], &$query_params = []) {

  // 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);
}