When you want to print multi-level lists with item_list theme, there is a configuration where the $data variable is not reset. This create duplicates in the rendered list.

Example:

$items = array(
  array(
    'children' => array('item 1', 'item 2'),
  ),
  array(
    'children' => array('item 3', 'item 4'),
  ),
);
theme('item_list', $items);

The result is:

    • item 1
    • item 2
    • item 1
    • item 2
    • item 3
    • item 4

Comments

Status: Needs review » Needs work

The last submitted patch, drupal_theme_item_list.patch, failed testing.

b-prod’s picture

StatusFileSize
new528 bytes
b-prod’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, drupal_theme_item_list.patch, failed testing.

b-prod’s picture

Status: Needs work » Needs review
StatusFileSize
new510 bytes
b-prod’s picture

StatusFileSize
new546 bytes

Sorry, it was not the right patch...

Status: Needs review » Needs work

The last submitted patch, drupal_theme_item_list.patch, failed testing.

b-prod’s picture

StatusFileSize
new555 bytes

Try again :)

b-prod’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, drupal_theme_item_list.patch, failed testing.

mattyoung’s picture

Version: 6.16 » 7.x-dev
Status: Needs work » Needs review
StatusFileSize
new782 bytes

D7 still has this bug.

mattyoung’s picture

Remove the tag put in by mistake

lars toomre’s picture

Version: 7.x-dev » 8.x-dev

Needs to be fixed in D8 first before D7 and D6 patches will even be considered.

This simple one line initializing the $data value looks good to me, but I do not have a testing environment to test the patch.

lars toomre’s picture

Updating the issue tags so flagged for backporting to D7 and D6.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

This fixes the bug described in the OP, as well as a PHP notice when $data isn't present.

xjm’s picture

Tagging issues not yet using summary template.

sun’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Sorry, but we need tests here.

Though this patch also somewhat duplicates the work in #256827: Various bugs in theme_item_list()

tim.plunkett’s picture

Version: 8.x-dev » 6.x-dev

This was apparently committed already in D7 and obsolete in D8.

http://drupalcode.org/project/drupal.git/commit/781b8961

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.