Meta issue: #1980004: [meta] Creating Dream Markup
Issue based on: #1939082: Convert theme_status_messages() to Twig

Questions:

Why do we use .messages class, when it can be more conveniently be used in the actual design?

Markup proposal:

{% for type, messages in messages_display %}
   <div class="site-messages {{ type }}">
    {% if status_headings[type] %}
      <h2 class="element-invisible">{{ status_headings[type] }}</h2>
    {% endif %}
    {% if messages|length > 1 %}
      <ul class="site-messages-list">
        {% for message in messages %}
          <li class="site-messages-single">{{ message }}</li>
        {% endfor %}
      </ul>
    {% else %}
      {{ messages.0 }}
    {% endif %}
  </div>
{% endfor %}
CommentFileSizeAuthor
#6 twig-status-messages-1982202-6.patch2.16 KBpbz1912
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

oresh’s picture

Project: » Drupal core
Version: » 8.x-dev
Component: Twig templates conversion (front-end branch) » markup
Category: feature » task

moving issue to core.

LewisNyman’s picture

ry5n’s picture

This is the current markup from #1986408: Message style update with a few bug fixes and enhancements:

<div class="messages messages--{{ type }}">
  <h2 class="visually-hidden">{{ title }}</h2>
  
  {% if messages|length > 1 %}
    <ul class="messages__list">
      {% for message in messages %}
      <li class="messages__item">{{ message }}</li>
      {% endfor %}
    </ul>
  {% else %}
    <div class="messages__item">{{ message }}</div>
  {% endif %}
</div>

This version is basically the same as in the summary, but it uses the new CSS standards: modifier class is used for the message type, and the component elements use the 'component__element' convention.

jenlampton’s picture

pbz1912’s picture

Assigned: Unassigned » pbz1912

I'm looking at this.

pbz1912’s picture

Assigned: pbz1912 » Unassigned
Status: Active » Needs review
FileSize
2.16 KB

This is probably awful and need some work. I've got Drupalflu really badly after Prague, but really wanted to put something up here.

LewisNyman’s picture

Status: Needs review » Needs work

The last submitted patch, 6: twig-status-messages-1982202-6.patch, failed testing.

LewisNyman’s picture

Issue summary: View changes
Status: Needs work » Closed (works as designed)

While attempting to reroll this patch, it seems like the work here has already been completed in #1939082: Convert theme_status_messages() to Twig and #2047175: Make the status message field discoverable by assistive technology agents; alert AT agent users to error messages.

Are there any other improvements to make?