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
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 774040-duplicate-data-with-children-element-11-D7.patch | 782 bytes | mattyoung |
| #8 | drupal_theme_item_list.patch | 555 bytes | b-prod |
| #6 | drupal_theme_item_list.patch | 546 bytes | b-prod |
| #5 | drupal_theme_item_list.patch | 510 bytes | b-prod |
| #2 | drupal_theme_item_list.patch | 528 bytes | b-prod |
Comments
Comment #2
b-prod commentedComment #3
b-prod commentedComment #5
b-prod commentedComment #6
b-prod commentedSorry, it was not the right patch...
Comment #8
b-prod commentedTry again :)
Comment #9
b-prod commentedComment #11
mattyoung commentedD7 still has this bug.
Comment #12
mattyoung commentedRemove the tag put in by mistake
Comment #13
lars toomre commentedNeeds 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.
Comment #14
lars toomre commentedUpdating the issue tags so flagged for backporting to D7 and D6.
Comment #15
tim.plunkettThis fixes the bug described in the OP, as well as a PHP notice when $data isn't present.
Comment #16
xjmTagging issues not yet using summary template.
Comment #17
sunSorry, but we need tests here.
Though this patch also somewhat duplicates the work in #256827: Various bugs in theme_item_list()
Comment #18
tim.plunkettThis was apparently committed already in D7 and obsolete in D8.
http://drupalcode.org/project/drupal.git/commit/781b8961