You are here

public function TwigExtension::getPath in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Template/TwigExtension.php \Drupal\Core\Template\TwigExtension::getPath()

Generates a URL path given a route name and parameters.

Parameters

$name: The name of the route.

array $parameters: An associative array of route parameters names and values.

array $options: (optional) An associative array of additional options. The 'absolute' option is forced to be FALSE. @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute().

Return value

string The generated URL path (relative URL) for the given route.

File

core/lib/Drupal/Core/Template/TwigExtension.php, line 222
Contains \Drupal\Core\Template\TwigExtension.

Class

TwigExtension
A class providing Drupal Twig extensions.

Namespace

Drupal\Core\Template

Code

public function getPath($name, $parameters = array(), $options = array()) {
  $options['absolute'] = FALSE;
  return $this->urlGenerator
    ->generateFromRoute($name, $parameters, $options);
}