Replace calls to theme('item_list') with calls to theme('links') for links, when a heading or wrapper div is warranted

Created on 1 July 2013, about 11 years ago
Updated 2 August 2024, about 2 months ago

Problem/Motivation

We have two very similar functions in Durpal theme_links and theme_item_list. Both of these functions loop through a set of items, and create a HTML list. This creates twice as much code to maintain, and two separate, nearly identical, things to keep up to date.

The plan is to use theme_links() when a title and/or wrapper div is necessary, and theme_links() will call theme('item_list') to generate the list of items within. In turn, theme_item_list() will not contain a wrapper div or title anymore.

Proposed resolution

This means we will need to update core to use theme_links()) any time a title or wrapper div is necessary, and may need to

  • Clean up or code so we are not passing in 'title' => NULL, to theme_item_list() that will no longer accept a title
  • Move the titles from item_list into a #prefix on the render element
  • Remove other weirdness in our code to make markup consistent
  • Update tests to test for the new markup insted of old

Remaining tasks

There are eighty-three (83) instances of 'item_list' in core. Below is a list of *only* the ones that will need to be updated (since they require either a title or a surrounding div tag)

List of all instances of calls to theme('item_list') or render arrays with '#theme' => 'item_list' where a title or wrapper div is warranted

User interface changes

None.

API changes

None.

Related Issues

📌 Replace links.html.twig with item-list--links.html.twig Needs work
📌 Remove title and wrapper div from item-list.html.twig Needs work

📌 Task
Status

Closed: outdated

Version

11.0 🔥

Component
Theme 

Last updated 40 minutes ago

Created by

🇺🇸United States jenlampton

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

  • Needs subsystem maintainer review

    It is used to alert the maintainer(s) of a particular core subsystem that an issue significantly impacts their subsystem, and their signoff is needed (see the governance policy draft for more information). Also, if you use this tag, make sure the issue component is set to the correct subsystem. If an issue significantly impacts more than one subsystem, use needs framework manager review instead.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇿New Zealand quietone New Zealand

    Both theme_links and theme_item_list have been removed from core. Instead twig templates, links.html.twig and item_list.html.twig, are used. Therefore, I am closing this as outdated.

Production build 0.71.5 2024