diff options
author | Neil Drumm <drumm@3064.no-reply.drupal.org> | 2006-08-17 06:55:26 +0000 |
---|---|---|
committer | Neil Drumm <drumm@3064.no-reply.drupal.org> | 2006-08-17 06:55:26 +0000 |
commit | 28f7908f8c1e09d678adad06ca6d7d69fe29d2f8 (patch) | |
tree | 9dc4166777ce538ffa9932185cb1da596e24c4b6 /includes | |
parent | a8584f1b183368edcd2e6b92ec2d57c983687d2f (diff) | |
download | brdo-28f7908f8c1e09d678adad06ca6d7d69fe29d2f8.tar.gz brdo-28f7908f8c1e09d678adad06ca6d7d69fe29d2f8.tar.bz2 |
#2039 by Boris Mann ("My first diff to the list"), moshe weitzman, and David Lesieur, nested lists.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/theme.inc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/includes/theme.inc b/includes/theme.inc index 79392b765..265653a27 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>"; |