diff --git a/core/lib/Drupal/Core/Template/TwigExtension.php b/core/lib/Drupal/Core/Template/TwigExtension.php index 95ccb60..3fcbe2c 100644 --- a/core/lib/Drupal/Core/Template/TwigExtension.php +++ b/core/lib/Drupal/Core/Template/TwigExtension.php @@ -605,7 +605,8 @@ public function safeJoin(\Twig_Environment $env, $value, $glue = '') { * Creates an Attribute object. * * @param array $attributes - * An associative array of key-value pairs to be converted to attributes. + * (optional) An associative array of key-value pairs to be converted to + * HTML attributes. * * @return \Drupal\Core\Template\Attribute * An attributes object that has the given attributes. diff --git a/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php index 6e5b674..10438c1 100644 --- a/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php +++ b/core/tests/Drupal/Tests/Core/Template/TwigExtensionTest.php @@ -319,6 +319,11 @@ public function testCreateAttribute() { $result = $twig->render("{% for iteration in iterations %}{% endfor %}", ['iterations' => $iterations]); $expected = '
'; $this->assertEquals($expected, $result); + + // Test default creation of empty attribute object and using it's method. + $result = $twig->render(""); + $expected = '
'; + $this->assertEquals($expected, $result); } }