summaryrefslogtreecommitdiff
path: root/includes/theme.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/theme.inc')
-rw-r--r--includes/theme.inc9
1 files changed, 8 insertions, 1 deletions
diff --git a/includes/theme.inc b/includes/theme.inc
index 5d6e07210..6f3dda76f 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -1493,7 +1493,8 @@ function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attribu
if (!empty($items)) {
$output .= "<$type". drupal_attributes($attributes) .'>';
- foreach ($items as $item) {
+ $num_items = count($items);
+ foreach ($items as $i => $item) {
$attributes = array();
$children = array();
if (is_array($item)) {
@@ -1515,6 +1516,12 @@ function theme_item_list($items = array(), $title = NULL, $type = 'ul', $attribu
if (count($children) > 0) {
$data .= theme_item_list($children, NULL, $type, $attributes); // Render nested list
}
+ if ($i == 0) {
+ $attributes['class'] = empty($attributes['class']) ? 'first' : ($attributes['class'] .' first');
+ }
+ if ($i == $num_items - 1) {
+ $attributes['class'] = empty($attributes['class']) ? 'last' : ($attributes['class'] .' last');
+ }
$output .= '<li'. drupal_attributes($attributes) .'>'. $data .'</li>';
}
$output .= "</$type>";