commit c0f7eae5529e5fe7a308cbedfe69431ec5444e62 Author: Joel Pittet Date: Sun Oct 20 13:45:07 2013 -0700 reverted h2 move to template diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 56d5b8e..8680e3d 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1632,14 +1632,15 @@ function template_preprocess_status_messages(&$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'). * - class: (optional) An array of the CSS classes for the heading. - * 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 + * 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 * http://juicystudio.com/article/screen-readers-display-none.php and * http://www.w3.org/TR/WCAG-TECHS/H42.html for more information. */ @@ -1651,12 +1652,13 @@ 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. + // Convert a string heading into an array, using a H2 tag by default. if (is_string($heading)) { $heading = array('text' => $heading); } // Merge in default array properties into $heading. $heading += array( + 'level' => 'h2', 'attributes' => array(), ); // @todo Remove backwards compatibility for $heading['class']. @@ -1692,7 +1694,7 @@ function template_preprocess_links(&$variables) { $class[] = 'active'; } // @todo Reconcile Views usage of 'ajax' as a boolean with the rest of - // core's usage of it as an array. + // core's usage of it as an array. $item = array( '#type' => 'link', '#title' => $link['title'], diff --git a/core/modules/system/templates/links.html.twig b/core/modules/system/templates/links.html.twig index a11a3f8..e895feb 100644 --- a/core/modules/system/templates/links.html.twig +++ b/core/modules/system/templates/links.html.twig @@ -18,8 +18,10 @@ * - heading: (optional) A heading to precede the links. May be an associative * array or a string. * - 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. + * If the heading is 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 @@ -37,7 +39,11 @@ {% spaceless %} {% if links %} {% if heading %} - {{ heading.text }} + {% if heading.level %} + <{{ heading.level }}{{ heading.attributes }}>{{ heading.text }} + {% else %} + {{ heading.text }} + {% endif %} {% endif %} {% for item in links %}