diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 9b89250..ed5afc4 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -633,15 +633,13 @@ function template_preprocess_datetime_wrapper(&$variables) { * associative array or a string. If it's an array, it can have the * following elements: * - text: The heading text. - * - level: The heading level (e.g. 'h2', 'h3'). * - attributes: (optional) An array of the CSS attributes for the heading. - * When using a string it will be used as the text of the heading and the - * level will default to 'h2'. Headings should be used on navigation menus - * and any list of links that consistently appears on multiple pages. To - * make the heading invisible use the 'visually-hidden' CSS class. Do not - * use 'display:none', which removes it from screen readers and assistive - * technology. Headings allow screen reader and keyboard only users to - * navigate to or skip the links. See + * When using a string it will be used as the text of the heading. + * Headings should be used on navigation menus and any list of links that + * consistently appears on multiple pages. To make the heading invisible use + * the 'visually-hidden' CSS class. Do not use 'display:none', which removes + * it from screen readers and assistive technology. Headings allow screen + * reader and keyboard only users to navigate to or skip the links. See * http://juicystudio.com/article/screen-readers-display-none.php and * http://www.w3.org/TR/WCAG-TECHS/H42.html for more information. * @@ -656,13 +654,12 @@ function template_preprocess_links(&$variables) { if (!empty($links)) { // Prepend the heading to the list, if any. if (!empty($heading)) { - // Convert a string heading into an array, using a

tag by default. + // Convert a string heading into an array. if (is_string($heading)) { $heading = array('text' => $heading); } // Merge in default array properties into $heading. $heading += array( - 'level' => 'h2', 'attributes' => array(), ); // Convert the attributes array into an Attribute object. diff --git a/core/modules/system/src/Tests/Theme/FunctionsTest.php b/core/modules/system/src/Tests/Theme/FunctionsTest.php index fa5a2ac..429d168 100644 --- a/core/modules/system/src/Tests/Theme/FunctionsTest.php +++ b/core/modules/system/src/Tests/Theme/FunctionsTest.php @@ -236,16 +236,15 @@ function testLinks() { // Verify that passing an array as heading works (core support). $variables['heading'] = array( 'text' => 'Links heading', - 'level' => 'h3', 'attributes' => array('class' => array('heading')), ); - $expected_heading = '

Links heading

'; + $expected_heading = '

Links heading

'; $expected = $expected_heading . $expected_links; $this->assertThemeOutput('links', $variables, $expected); // Verify that passing attributes for the heading works. - $variables['heading'] = array('text' => 'Links heading', 'level' => 'h3', 'attributes' => array('id' => 'heading')); - $expected_heading = '

Links heading

'; + $variables['heading'] = array('text' => 'Links heading', 'attributes' => array('id' => 'heading')); + $expected_heading = '

Links heading

'; $expected = $expected_heading . $expected_links; $this->assertThemeOutput('links', $variables, $expected); @@ -357,16 +356,15 @@ function testIndexedKeyedLinks() { // Verify that passing an array as heading works (core support). $variables['heading'] = [ 'text' => 'Links heading', - 'level' => 'h3', 'attributes' => ['class' => ['heading']], ]; - $expected_heading = '

Links heading

'; + $expected_heading = '

Links heading

'; $expected = $expected_heading . $expected_links; $this->assertThemeOutput('links', $variables, $expected); // Verify that passing attributes for the heading works. - $variables['heading'] = ['text' => 'Links heading', 'level' => 'h3', 'attributes' => ['id' => 'heading']]; - $expected_heading = '

Links heading

'; + $variables['heading'] = ['text' => 'Links heading', 'attributes' => ['id' => 'heading']]; + $expected_heading = '

Links heading

'; $expected = $expected_heading . $expected_links; $this->assertThemeOutput('links', $variables, $expected); diff --git a/core/modules/system/templates/links.html.twig b/core/modules/system/templates/links.html.twig index 77e7260..fb9e36d 100644 --- a/core/modules/system/templates/links.html.twig +++ b/core/modules/system/templates/links.html.twig @@ -15,10 +15,8 @@ * tag if no 'href' is supplied. * - heading: (optional) A heading to precede the links. * - text: The heading text. - * - level: The heading level (e.g. 'h2', 'h3'). * - attributes: (optional) A keyed list of attributes for the heading. - * If the heading is a string, it will be used as the text of the heading and - * the level will default to 'h2'. + * If the heading is a string, it will be used as the text of the heading. * * Headings should be used on navigation menus and any list of links that * consistently appears on multiple pages. To make the heading invisible use diff --git a/core/themes/classy/templates/content/links--node.html.twig b/core/themes/classy/templates/content/links--node.html.twig index a7b91e7..b2d50e7 100644 --- a/core/themes/classy/templates/content/links--node.html.twig +++ b/core/themes/classy/templates/content/links--node.html.twig @@ -15,10 +15,8 @@ * tag if no 'href' is supplied. * - heading: (optional) A heading to precede the links. * - text: The heading text. - * - level: The heading level (e.g. 'h2', 'h3'). * - attributes: (optional) A keyed list of attributes for the heading. - * If the heading is a string, it will be used as the text of the heading and - * the level will default to 'h2'. + * If the heading is a string, it will be used as the text of the heading. * * Headings should be used on navigation menus and any list of links that * consistently appears on multiple pages. To make the heading invisible use diff --git a/core/themes/classy/templates/navigation/links.html.twig b/core/themes/classy/templates/navigation/links.html.twig index c1bff6b..104f846 100644 --- a/core/themes/classy/templates/navigation/links.html.twig +++ b/core/themes/classy/templates/navigation/links.html.twig @@ -15,10 +15,8 @@ * tag if no 'href' is supplied. * - heading: (optional) A heading to precede the links. * - text: The heading text. - * - level: The heading level (e.g. 'h2', 'h3'). * - attributes: (optional) A keyed list of attributes for the heading. - * If the heading is a string, it will be used as the text of the heading and - * the level will default to 'h2'. + * If the heading is a string, it will be used as the text of the heading. * * Headings should be used on navigation menus and any list of links that * consistently appears on multiple pages. To make the heading invisible use @@ -33,11 +31,7 @@ #} {% if links -%} {%- if heading -%} - {%- if heading.level -%} - <{{ heading.level }}{{ heading.attributes }}>{{ heading.text }} - {%- else -%} - {{ heading.text }} - {%- endif -%} + {{ heading.text }} {%- endif -%} {%- for item in links -%} diff --git a/core/themes/stable/templates/navigation/links.html.twig b/core/themes/stable/templates/navigation/links.html.twig index c1bff6b..104f846 100644 --- a/core/themes/stable/templates/navigation/links.html.twig +++ b/core/themes/stable/templates/navigation/links.html.twig @@ -15,10 +15,8 @@ * tag if no 'href' is supplied. * - heading: (optional) A heading to precede the links. * - text: The heading text. - * - level: The heading level (e.g. 'h2', 'h3'). * - attributes: (optional) A keyed list of attributes for the heading. - * If the heading is a string, it will be used as the text of the heading and - * the level will default to 'h2'. + * If the heading is a string, it will be used as the text of the heading. * * Headings should be used on navigation menus and any list of links that * consistently appears on multiple pages. To make the heading invisible use @@ -33,11 +31,7 @@ #} {% if links -%} {%- if heading -%} - {%- if heading.level -%} - <{{ heading.level }}{{ heading.attributes }}>{{ heading.text }} - {%- else -%} - {{ heading.text }} - {%- endif -%} + {{ heading.text }} {%- endif -%} {%- for item in links -%}