material_base-8.x-2.x-dev/templates/misc/status-messages.html.twig

templates/misc/status-messages.html.twig
{#
/**
 * @file
 * Theme override for status messages.
 *
 * Displays status, error, and warning messages, grouped by type.
 *
 * An invisible heading identifies the messages for assistive technology.
 * Sighted users see a colored box. See http://www.w3.org/TR/WCAG-TECHS/H69.html
 * for info.
 *
 * Add an ARIA label to the contentinfo area so that assistive technology
 * user agents will better describe this landmark.
 *
 * Available variables:
 * - message_list: List of messages to be displayed, grouped by type.
 * - status_headings: List of all status types.
 * - attributes: HTML attributes for the element, including:
 *   - class: HTML classes.
 */
#}
<div data-drupal-messages>
  {% if message_list is not empty %}
    <div class="messages__group">
      {% for type, messages in message_list %}
        {% set classes = [
            'messages',
            'messages--' ~ type,
            'messages--colored',
            messages_fixed ? 'messages--fixed',
        ] %}

        {% if type == 'error' %}
          {% set message_icon = 'warning' %}
        {% elseif type == 'warning' %}
          {% set message_icon = 'info' %}
        {% else %}
          {% set message_icon = 'check_circle' %}
        {% endif %}
        
        <div role="{{ type == 'error' ? 'alert' : 'contentinfo' }}" aria-label="{{ status_headings[type] }}"{{ attributes.addClass(classes)|without('role', 'aria-label') }}>
          
          {% if status_headings[type] %}
            <h2 class="visually-hidden">{{ status_headings[type] }}</h2>
          {% endif %}

          <div class="messages__icon">
            {% include "@material_base/components/01_atoms/icon.twig" with {
              data: {
                value: message_icon,
              },
              settings: {
                type: 'svg-sprite',
              }
            } %}
          </div>

          <div class="messages__content">
            {% if messages|length > 1 %}
              <ul class="messages__list">
                {% for message in messages %}
                  <li class="messages__item">{{ message }}</li>
                {% endfor %}
              </ul>
            {% else %}
              {{ messages|first }}
            {% endif %}
          </div>

          <div class="messages__close">
            <div class="messages__close-button">
              {% include "@material_base/components/01_atoms/icon.twig" with {
                data: {
                  value: 'close',
                },
                settings: {
                  type: 'svg-sprite',
                }
              } %}
            </div>
          </div>

        </div>
        {# Remove type specific classes. #}
        {% set attributes = attributes.removeClass(classes) %}
      {% endfor %}
    </div>
  {% endif %}
</div>

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc