annotate core/modules/system/templates/links.html.twig @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 {#
Chris@0 2 /**
Chris@0 3 * @file
Chris@0 4 * Default theme implementation for a set of links.
Chris@0 5 *
Chris@0 6 * Available variables:
Chris@0 7 * - attributes: Attributes for the UL containing the list of links.
Chris@0 8 * - links: Links to be output.
Chris@0 9 * Each link will have the following elements:
Chris@0 10 * - title: The link text.
Chris@0 11 * - url: The link URL. If omitted, the 'title' is shown as a plain text
Chris@0 12 * item in the links list. If 'url' is supplied, the entire link is passed
Chris@0 13 * to l() as its $options parameter.
Chris@0 14 * - attributes: (optional) HTML attributes for the anchor, or for the <span>
Chris@0 15 * tag if no 'url' is supplied.
Chris@0 16 * - heading: (optional) A heading to precede the links.
Chris@0 17 * - text: The heading text.
Chris@0 18 * - level: The heading level (e.g. 'h2', 'h3').
Chris@0 19 * - attributes: (optional) A keyed list of attributes for the heading.
Chris@0 20 * If the heading is a string, it will be used as the text of the heading and
Chris@0 21 * the level will default to 'h2'.
Chris@0 22 *
Chris@0 23 * Headings should be used on navigation menus and any list of links that
Chris@0 24 * consistently appears on multiple pages. To make the heading invisible use
Chris@0 25 * the 'visually-hidden' CSS class. Do not use 'display:none', which
Chris@0 26 * removes it from screen readers and assistive technology. Headings allow
Chris@0 27 * screen reader and keyboard only users to navigate to or skip the links.
Chris@0 28 * See http://juicystudio.com/article/screen-readers-display-none.php and
Chris@0 29 * http://www.w3.org/TR/WCAG-TECHS/H42.html for more information.
Chris@0 30 *
Chris@0 31 * @see template_preprocess_links()
Chris@0 32 *
Chris@0 33 * @ingroup themeable
Chris@0 34 */
Chris@0 35 #}
Chris@0 36 {% if links -%}
Chris@0 37 {%- if heading -%}
Chris@0 38 {%- if heading.level -%}
Chris@0 39 <{{ heading.level }}{{ heading.attributes }}>{{ heading.text }}</{{ heading.level }}>
Chris@0 40 {%- else -%}
Chris@0 41 <h2{{ heading.attributes }}>{{ heading.text }}</h2>
Chris@0 42 {%- endif -%}
Chris@0 43 {%- endif -%}
Chris@0 44 <ul{{ attributes }}>
Chris@0 45 {%- for item in links -%}
Chris@0 46 <li{{ item.attributes }}>
Chris@0 47 {%- if item.link -%}
Chris@0 48 {{ item.link }}
Chris@0 49 {%- elseif item.text_attributes -%}
Chris@0 50 <span{{ item.text_attributes }}>{{ item.text }}</span>
Chris@0 51 {%- else -%}
Chris@0 52 {{ item.text }}
Chris@0 53 {%- endif -%}
Chris@0 54 </li>
Chris@0 55 {%- endfor -%}
Chris@0 56 </ul>
Chris@0 57 {%- endif %}