Issue #1842140 by mdrummond, tonystar, gavin.hughes, killerpoke, lauriii, droweski, stevector, omg-its-maggie, jenlampton, Renee S: Remove title and wrapper div from theme_item_list.
We are currently printing a title and wrapper div in item list templates. Templates really should be as concise and semantic as possible, and only print a div when it's really needed, the title should be a separate element. The class from the wrapper div can be moved to the ul/ol tag, and the CSS can be updated to match.
When we need a heading tag and/or a wrapper div, we should call theme_links instead. That theme function can then call theme('item_list') which will generate a nice clean list. When we only need a nice clean list, we can call this function directly.
Proposed code fo the item list template:
{% spaceless %}
{%- if list_type == 'ul' -%}
<ul{{ attributes }}>
{%- else -%}
<ol{{ attributes }}>
{%- endif %}
{%- for item in items -%}
<li{{ item['#wrapper_attributes'] }}>{{ item }}</li>
{%- endfor -%}
{%- if list_type == 'ul' -%}
</ul>
{%- else -%}
</ol>
{%- endif %}
{% endspaceless %}
None.
Call theme('links') when you need a wrapper div and/or a title.
Call theme(item_list) when you only need a list.
📌
Replace links.html.twig with item-list--links.html.twig
Needs work
#2032645: Replace calls to theme('item_list') with calls to theme('links') for links, when a heading or wrapper div is warranted →
#891112: Replace theme_item_list()'s 'data' items with render elements →
#1777326: Replace theme_links() with theme_item_list() →
#1910996: Update theme_item_list to call theme_ol or theme_ul →
#1980004: [meta] Creating Dream Markup →
Needs work
10.1 ✨
Last updated
The change alters the user interface, so before and after screenshots should be added to document the UI change. Make sure to capture the relevant region only. Use a tool such as Aviary on Windows or Skitch on Mac OS X.
Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.