diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 81e8f374ded52ddff3b33eea18945400a41251df..fe9bbbe0270a29879e7f40d76dd089b2a2894df3 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -45,6 +45,7 @@ Drupal x.x.x, xxxx-xx-xx (development version) - upgrade system: * created space for update branches. - split up and removed drupal.css. +- added nested lists generation. Drupal 4.7.0, 2006-05-01 ------------------------ diff --git a/includes/theme.inc b/includes/theme.inc index 79392b76520f39b2f0c35cad87d4d1958e2a3cdb..265653a277e38566ae809000f19004ed39f3f52b 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -835,8 +835,9 @@ function theme_mark($type = MARK_NEW) { * @param $items * An array of items to be displayed in the list. If an item is a string, * then it is used as is. If an item is an array, then the "data" element of - * the array is used as the contents of the list item and all other elements - * are treated as attributes of the list item element. + * the array is used as the contents of the list item. If an item is an array + * with a "children" element, those children are displayed in a nested list. + * All other elements are treated as attributes of the list item element. * @param $title * The title of the list. * @param $attributes @@ -856,11 +857,15 @@ function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attribu $output .= "<$type" . drupal_attributes($attributes) . '>'; foreach ($items as $item) { $attributes = array(); + $children = array(); if (is_array($item)) { foreach ($item as $key => $value) { if ($key == 'data') { $data = $value; } + elseif ($key == 'children') { + $children = $value; + } else { $attributes[$key] = $value; } @@ -869,6 +874,9 @@ function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attribu else { $data = $item; } + if (count($children) > 0) { + $data .= theme_item_list($children, NULL, $type, $attributes); // Render nested list + } $output .= '<li' . drupal_attributes($attributes) . '>'. $data .'</li>'; } $output .= "</$type>";