diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php index 0294e18..e71d9d0 100644 --- a/core/lib/Drupal/Core/Template/TwigExtension.php +++ b/core/lib/Drupal/Core/Template/TwigExtension.php @@ -75,7 +75,7 @@ public function getFunctions() { new \Twig_SimpleFunction('url', array($this, 'getUrl'), array('is_safe_callback' => array($this, 'isUrlGenerationSafe'))), new \Twig_SimpleFunction('path', array($this, 'getPath'), array('is_safe_callback' => array($this, 'isUrlGenerationSafe'))), new \Twig_SimpleFunction('url_from_path', array($this, 'getUrlFromPath'), array('is_safe_callback' => array($this, 'isUrlGenerationSafe'))), - new \Twig_SimpleFunction('link_from_url', array($this, 'getLinkFromUrl')), + new \Twig_SimpleFunction('link', array($this, 'getLink')), ); } @@ -208,7 +208,7 @@ public function getUrlFromPath($path, $options = array()) { * @return string * An HTML string containing a link to the given url. */ - public function getLinkFromUrl($text, $url) { + public function getLink($text, $url) { if ($url instanceof Url) { return $this->linkGenerator->generateFromUrl($text, $url); } diff --git a/core/modules/system/templates/menu.html.twig b/core/modules/system/templates/menu.html.twig index 4f6daed..9f676d3 100644 --- a/core/modules/system/templates/menu.html.twig +++ b/core/modules/system/templates/menu.html.twig @@ -34,7 +34,7 @@ {% endif %} {% for item in items %} - {{ link_from_url(item.title, item.url) }} + {{ link(item.title, item.url) }} {% if item.below %} {{ menus.menu_links(item.below, attributes, menu_level + 1) }} {% endif %} diff --git a/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.link_generator.html.twig b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.link_generator.html.twig index e5bf772..a365859 100644 --- a/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.link_generator.html.twig +++ b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.link_generator.html.twig @@ -1 +1 @@ -
link via the linkgenerator: {{ link_from_url("register", test_url) }}
+
link via the linkgenerator: {{ link("register", test_url) }}