Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292377

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

$
0
0

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 either

  1. Update the CSS to reflect attributes that are added to the UL tag now instead of the surrounding div tag
  2. Clean up or code so we are not passing in 'title' => NULL, to theme_item_list() that no longer accepts a title
  3. Move the titles from item_list into a #prefix on the render element
  4. Remove other weirdness in our code to make markup consistent
  5. Update tests to test for the new markup instad 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

Location of item_list callCall theme('links') instead / whyrelated cleanup
core/authorize.phpYES (title) N/A
core/modules/field/lib/Drupal/field/Plugin/views/field/Field.phpNO 2) Remove 'title' => NULL,
core/includes/theme.maintenance.incNO (not links) 3) move heading into #prefix on render element
core/modules/node/node.moduleYES (title) N/A
core/modules/system/css/system.theme.css NO CSS cleanup
core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php NO 5) update tests to exclude title
core/modules/system/system.module NO N/A
core/modules/system/system.module NO 1) Update CSS - classes moved to ul
core/modules/toolbar/tests/modules/toolbar_test/toolbar_test.module YES (title) N/A
core/modules/tour/lib/Drupal/tour/TourRenderController.php NO 1) Update CSS - id and class moved to UL
core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php NO 4) $form['analysis'] needs to be updated to add the form-item class as attributes, no extra div plz
core/modules/views/lib/Drupal/views/Plugin/views/field/PrerenderList.php NO
core/modules/views/lib/Drupal/views/Plugin/views/PluginBase.php NO 1) Update CSS - classes moved to ul
core/modules/views/views.theme.inc 1) Update CSS - classes moved to ul, Remove '#title' => NULL,
core/update.php NO (not links) 3) move title into #prefix on render element

User interface changes

None.

API changes

TBD

#311011: Make theme_links() use theme_item_list()
#1842140: Remove title and wrapper div from theme_item_list


Viewing all articles
Browse latest Browse all 292377

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>