annotate core/themes/classy/templates/misc/status-messages.html.twig @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents af1871eacc83
children
rev   line source
Chris@0 1 {#
Chris@0 2 /**
Chris@0 3 * @file
Chris@0 4 * Theme override for status messages.
Chris@0 5 *
Chris@0 6 * Displays status, error, and warning messages, grouped by type.
Chris@0 7 *
Chris@0 8 * An invisible heading identifies the messages for assistive technology.
Chris@0 9 * Sighted users see a colored box. See http://www.w3.org/TR/WCAG-TECHS/H69.html
Chris@0 10 * for info.
Chris@0 11 *
Chris@0 12 * Add an ARIA label to the contentinfo area so that assistive technology
Chris@0 13 * user agents will better describe this landmark.
Chris@0 14 *
Chris@0 15 * Available variables:
Chris@0 16 * - message_list: List of messages to be displayed, grouped by type.
Chris@0 17 * - status_headings: List of all status types.
Chris@0 18 * - attributes: HTML attributes for the element, including:
Chris@0 19 * - class: HTML classes.
Chris@0 20 */
Chris@0 21 #}
Chris@18 22 <div data-drupal-messages>
Chris@0 23 {% block messages %}
Chris@0 24 {% for type, messages in message_list %}
Chris@0 25 {%
Chris@0 26 set classes = [
Chris@0 27 'messages',
Chris@0 28 'messages--' ~ type,
Chris@0 29 ]
Chris@0 30 %}
Chris@0 31 <div role="contentinfo" aria-label="{{ status_headings[type] }}"{{ attributes.addClass(classes)|without('role', 'aria-label') }}>
Chris@0 32 {% if type == 'error' %}
Chris@0 33 <div role="alert">
Chris@0 34 {% endif %}
Chris@0 35 {% if status_headings[type] %}
Chris@0 36 <h2 class="visually-hidden">{{ status_headings[type] }}</h2>
Chris@0 37 {% endif %}
Chris@0 38 {% if messages|length > 1 %}
Chris@0 39 <ul class="messages__list">
Chris@0 40 {% for message in messages %}
Chris@0 41 <li class="messages__item">{{ message }}</li>
Chris@0 42 {% endfor %}
Chris@0 43 </ul>
Chris@0 44 {% else %}
Chris@0 45 {{ messages|first }}
Chris@0 46 {% endif %}
Chris@0 47 {% if type == 'error' %}
Chris@0 48 </div>
Chris@0 49 {% endif %}
Chris@0 50 </div>
Chris@0 51 {# Remove type specific classes. #}
Chris@0 52 {% set attributes = attributes.removeClass(classes) %}
Chris@0 53 {% endfor %}
Chris@0 54 {% endblock messages %}
Chris@18 55 </div>