diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php index ed7fad7..b26d169 100644 --- a/core/lib/Drupal/Core/Template/TwigExtension.php +++ b/core/lib/Drupal/Core/Template/TwigExtension.php @@ -51,9 +51,9 @@ public function getFunctions() { // @todo re-add unset => twig_unset if this is really needed return array( // @todo Remove URL function once http://drupal.org/node/1778610 is resolved. - 'url_from_path' => new \Twig_Function_Function('url'), - 'url' => new \Twig_SimpleFunction('get_url', array($this, 'generateUrl')), - 'link' => new \Twig_SimpleFunction('get_link', array($this, 'generateLink'), array('is_safe' => array('html'))), + 'url_from_path' => new \Twig_SimpleFunction('url_from_path', array($this, 'generateFromPath')), + 'url' => new \Twig_SimpleFunction('url', array($this, 'generateUrl')), + 'link' => new \Twig_SimpleFunction('link', array($this, 'generateLink'), array('is_safe' => array('html'))), // These functions will receive a TwigReference object, if a render array is detected 'hide' => new TwigReferenceFunction('twig_hide'), 'render_var' => new TwigReferenceFunction('twig_render_var'), @@ -106,6 +106,15 @@ public function generateUrl($route_name, $route_parameters = array(), $options = } /** + * Generates a URL using the route generator and the method generateFromPath. + * + * @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromPath() + */ + public function generateFromPath($path, $options = array()) { + return $this->urlGenerator->generateFromPath($path, $options); + } + + /** * Generates a link (A tag) using the link generator. * * @see \Drupal\Core\Utility\LinkGeneratorInterface::generate()