From ff1d0fccf766764d0fa925f2ac9336c5543bb31d Mon Sep 17 00:00:00 2001 From: David Rothstein Date: Sun, 4 Nov 2012 23:19:40 -0500 Subject: Issue #1809836 by danillonunes: Fixed theme_item_list() is broken when 'items' variable is an associative array. --- includes/theme.inc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'includes') diff --git a/includes/theme.inc b/includes/theme.inc index 1f8dfcf9e..777922f05 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -2069,10 +2069,12 @@ function theme_item_list($variables) { if (!empty($items)) { $output .= "<$type" . drupal_attributes($attributes) . '>'; $num_items = count($items); - foreach ($items as $i => $item) { + $i = 0; + foreach ($items as $item) { $attributes = array(); $children = array(); $data = ''; + $i++; if (is_array($item)) { foreach ($item as $key => $value) { if ($key == 'data') { @@ -2093,10 +2095,10 @@ function theme_item_list($variables) { // Render nested list. $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes)); } - if ($i == 0) { + if ($i == 1) { $attributes['class'][] = 'first'; } - if ($i == $num_items - 1) { + if ($i == $num_items) { $attributes['class'][] = 'last'; } $output .= '' . $data . "\n"; -- cgit v1.2.3