From efb10dfd175df07f57e0e0a262a09be587362ca8 Mon Sep 17 00:00:00 2001 From: Neil Drumm Date: Sun, 2 Jul 2006 00:25:40 +0000 Subject: #52059 by Crell, allow attributes for items in theme_item_list(). --- includes/theme.inc | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/includes/theme.inc b/includes/theme.inc index ab311ce08..d26bb80fa 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -839,7 +839,10 @@ function theme_stylesheet_import($path, $media = 'all') { * Return a themed list of items. * * @param $items - * An array of items to be displayed in the list. + * 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. * @param $title * The title of the list. * @param $attributes @@ -858,7 +861,21 @@ function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attribu if (!empty($items)) { $output .= "<$type" . drupal_attributes($attributes) . '>'; foreach ($items as $item) { - $output .= '
  • '. $item .'
  • '; + $attributes = array(); + if (is_array($item)) { + foreach ($item as $key => $value) { + if ($key == 'data') { + $data = $value; + } + else { + $attributes[$key] = $value; + } + } + } + else { + $data = $item; + } + $output .= ''. $data .''; } $output .= ""; } -- cgit v1.2.3