diff options
author | Neil Drumm <drumm@3064.no-reply.drupal.org> | 2006-07-02 00:25:40 +0000 |
---|---|---|
committer | Neil Drumm <drumm@3064.no-reply.drupal.org> | 2006-07-02 00:25:40 +0000 |
commit | efb10dfd175df07f57e0e0a262a09be587362ca8 (patch) | |
tree | f8a7e84696b9d54daf8a048c64eb21fa8ef0ff50 /includes/theme.inc | |
parent | dd0fbaea0e882cfc1bbfcd2ef084af0ba9e00369 (diff) | |
download | brdo-efb10dfd175df07f57e0e0a262a09be587362ca8.tar.gz brdo-efb10dfd175df07f57e0e0a262a09be587362ca8.tar.bz2 |
#52059 by Crell, allow attributes for items in theme_item_list().
Diffstat (limited to 'includes/theme.inc')
-rw-r--r-- | includes/theme.inc | 21 |
1 files 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 .= '<li>'. $item .'</li>'; + $attributes = array(); + if (is_array($item)) { + foreach ($item as $key => $value) { + if ($key == 'data') { + $data = $value; + } + else { + $attributes[$key] = $value; + } + } + } + else { + $data = $item; + } + $output .= '<li' . drupal_attributes($attributes) . '>'. $data .'</li>'; } $output .= "</$type>"; } |