diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php index 881df6d..47e445b 100644 --- a/core/lib/Drupal/Core/Template/TwigExtension.php +++ b/core/lib/Drupal/Core/Template/TwigExtension.php @@ -117,14 +117,14 @@ public function getName() { * @param $name * The name of the route. * @param array $parameters - * An associative array of parameter names and values. + * An associative array of route parameters names and values. * @param array $options * (optional) An associative array of additional options. The 'absolute' * option is forced to be FALSE. * @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute(). * * @return string - * The generated URL path for the given route. + * The generated URL path (relative URL) for the given route. */ public function getPath($name, $parameters = array(), $options = array()) { $options['absolute'] = FALSE; @@ -137,7 +137,7 @@ public function getPath($name, $parameters = array(), $options = array()) { * @param $name * The name of the route. * @param array $parameters - * An associative array of parameter names and values. + * An associative array of route parameter names and values. * @param array $options * (optional) An associative array of additional options. The 'absolute' * option is forced to be TRUE. @@ -175,7 +175,7 @@ public function getUrlFromPath($path, $options = array()) { * Saves the unneeded automatic escaping for performance reasons. * * The URL generation process percent encodes non-alphanumeric characters. - * Thus, the only character within an URL that must be escaped in html is the + * Thus, the only character within an URL that must be escaped in HTML is the * ampersand ("&") which separates query params. Thus we cannot mark * the generated URL as always safe, but only when we are sure there won't be * multiple query params. This is the case when there are none or only one @@ -188,15 +188,17 @@ public function getUrlFromPath($path, $options = array()) { * - path('route', {'param': ['val1', 'val2'] }) // a sub-array * - path('route', {'param1': 'value1', 'param2': 'value2'}) * If param1 and param2 reference placeholders in the route, it would not - * need to be escaped, But we don't know that in advance. + * need to be escaped, but we don't know that in advance. * - * @param \Twig_Node $argsNode The arguments of the path/url function + * @param \Twig_Node $args_node + * The arguments of the path/url functions. * - * @return array An array with the contexts the URL is safe + * @return array + * An array with the contexts the URL is safe */ - public function isUrlGenerationSafe(\Twig_Node $argsNode) { + public function isUrlGenerationSafe(\Twig_Node $args_node) { // Support named arguments. - $parameter_node = $argsNode->hasNode('parameters') ? $argsNode->getNode('parameters') : ($argsNode->hasNode(1) ? $argsNode->getNode(1) : NULL); + $parameter_node = $args_node->hasNode('parameters') ? $args_node->getNode('parameters') : ($args_node->hasNode(1) ? $args_node->getNode(1) : NULL); if (!isset($parameter_node) || $parameter_node instanceof \Twig_Node_Expression_Array && count($parameter_node) <= 2 && (!$parameter_node->hasNode(1) || $parameter_node->getNode(1) instanceof \Twig_Node_Expression_Constant)) { diff --git a/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.url_generator.html.twig b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.url_generator.html.twig index 5479a4f..131a612 100644 --- a/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.url_generator.html.twig +++ b/core/modules/system/tests/modules/twig_theme_test/templates/twig_theme_test.url_generator.html.twig @@ -3,5 +3,5 @@