# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: includes/theme.inc --- includes/theme.inc Base (1.422) +++ includes/theme.inc Locally Modified (Based On 1.422) @@ -1395,34 +1395,57 @@ * All other elements are treated as attributes of the list item element. * @param $title * The title of the list. - * @param $attributes - * The attributes applied to the list element. * @param $type - * The type of list to return (e.g. "ul", "ol") + * The type of list to return (e.g. "ul", "ol"). + * @param $attributes + * The attributes to be applied to the list element. * @return * A string containing the list output. */ function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = NULL) { - $output = '
'; + $output = _theme_item_list($items); if (isset($title)) { - $output .= '

' . $title . '

'; + $output = '

' . $title . '

' . $output; } + $output = "<$type" . drupal_attributes($attributes) . '>' . $output . ""; + $output = '
' . $output . '
'; - if (!empty($items)) { - $output .= "<$type" . drupal_attributes($attributes) . '>'; + return $output; +} + +/** + * Helper to theme list of items for theme_item_list(). + * + * @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. 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. + * @return + * A string containing the list output. + */ +function _theme_item_list($items = array()) { + $items = array(); $num_items = count($items); - foreach ($items as $i => $item) { + $i = 0; + foreach ($items as $item) { + $i++; $attributes = array(); $children = array(); if (is_array($item)) { + $data = ''; foreach ($item as $key => $value) { - if ($key == 'data') { + switch ($key) { + case 'data': $data = $value; - } - elseif ($key == 'children') { + break; + + case 'children': $children = $value; - } - else { + break; + + default: $attributes[$key] = $value; } } @@ -1439,12 +1462,23 @@ if ($i == $num_items - 1) { $attributes['class'] = empty($attributes['class']) ? 'last' : ($attributes['class'] . ' last'); } - $output .= '' . $data . "\n"; + $items[] = theme('list_item', $data, $attributes); } - $output .= ""; + return "\n" . implode("\n", $items) . "\n"; } - $output .= '
'; - return $output; + +/** + * Return a themed item for a list. + * + * @param $data + * Data containing HTML for the item. + * @param $attributes + * The attributes to apply to the item. + * @return + * A string containing the item. + */ +function theme_list_item($data, $attributes) { + return '' . $data . ''; } /**