#2039 by Boris Mann ("My first diff to the list"), moshe weitzman, and David Lesieur, nested lists.
parent
a8584f1b18
commit
28f7908f8c
|
@ -45,6 +45,7 @@ Drupal x.x.x, xxxx-xx-xx (development version)
|
||||||
- upgrade system:
|
- upgrade system:
|
||||||
* created space for update branches.
|
* created space for update branches.
|
||||||
- split up and removed drupal.css.
|
- split up and removed drupal.css.
|
||||||
|
- added nested lists generation.
|
||||||
|
|
||||||
Drupal 4.7.0, 2006-05-01
|
Drupal 4.7.0, 2006-05-01
|
||||||
------------------------
|
------------------------
|
||||||
|
|
|
@ -835,8 +835,9 @@ function theme_mark($type = MARK_NEW) {
|
||||||
* @param $items
|
* @param $items
|
||||||
* An array of items to be displayed in the list. If an item is a string,
|
* 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
|
* 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
|
* the array is used as the contents of the list item. If an item is an array
|
||||||
* are treated as attributes of the list item element.
|
* 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
|
* @param $title
|
||||||
* The title of the list.
|
* The title of the list.
|
||||||
* @param $attributes
|
* @param $attributes
|
||||||
|
@ -856,11 +857,15 @@ function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attribu
|
||||||
$output .= "<$type" . drupal_attributes($attributes) . '>';
|
$output .= "<$type" . drupal_attributes($attributes) . '>';
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
|
$children = array();
|
||||||
if (is_array($item)) {
|
if (is_array($item)) {
|
||||||
foreach ($item as $key => $value) {
|
foreach ($item as $key => $value) {
|
||||||
if ($key == 'data') {
|
if ($key == 'data') {
|
||||||
$data = $value;
|
$data = $value;
|
||||||
}
|
}
|
||||||
|
elseif ($key == 'children') {
|
||||||
|
$children = $value;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$attributes[$key] = $value;
|
$attributes[$key] = $value;
|
||||||
}
|
}
|
||||||
|
@ -869,6 +874,9 @@ function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attribu
|
||||||
else {
|
else {
|
||||||
$data = $item;
|
$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 .= '<li' . drupal_attributes($attributes) . '>'. $data .'</li>';
|
||||||
}
|
}
|
||||||
$output .= "</$type>";
|
$output .= "</$type>";
|
||||||
|
|
Loading…
Reference in New Issue