Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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 %}
Comment | File | Size | Author |
---|---|---|---|
#6 | twig-status-messages-1982202-6.patch | 2.16 KB | pbz1912 |
Comments
Comment #1
oresh CreditAttribution: oresh commentedmoving issue to core.
Comment #2
LewisNymanRELATED: #1986408: Message style update
Comment #3
ry5n CreditAttribution: ry5n commentedThis is the current markup from #1986408: Message style update with a few bug fixes and enhancements:
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.
Comment #4
jenlamptonRelated #1939082: Convert theme_status_messages() to Twig
Comment #5
pbz1912 CreditAttribution: pbz1912 commentedI'm looking at this.
Comment #6
pbz1912 CreditAttribution: pbz1912 commentedThis is probably awful and need some work. I've got Drupalflu really badly after Prague, but really wanted to put something up here.
Comment #7
LewisNyman6: twig-status-messages-1982202-6.patch queued for re-testing.
Comment #9
LewisNymanWhile 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?