Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.435
diff -u -r1.435 theme.inc
--- includes/theme.inc 15 Sep 2008 20:48:07 -0000 1.435
+++ includes/theme.inc 20 Sep 2008 03:40:42 -0000
@@ -1101,53 +1101,32 @@
* A string containing an unordered list of links.
*/
function theme_links($links, $attributes = array('class' => 'links')) {
- $output = '';
-
- if (count($links) > 0) {
- $output = '
';
-
- $num_links = count($links);
- $i = 1;
-
- foreach ($links as $key => $link) {
- $class = $key;
-
- // Add first, last and active classes to the list of links to help out themers.
- if ($i == 1) {
- $class .= ' first';
- }
- if ($i == $num_links) {
- $class .= ' last';
- }
- if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '' && drupal_is_front_page()))) {
- $class .= ' active';
- }
- $output .= '- $class)) . '>';
-
- if (isset($link['href'])) {
- // Pass in $link as $options, they share the same keys.
- $output .= l($link['title'], $link['href'], $link);
- }
- else if (!empty($link['title'])) {
- // Some links are actually not links, but we wrap these in for adding title and class attributes
- if (empty($link['html'])) {
- $link['title'] = check_plain($link['title']);
- }
- $span_attributes = '';
- if (isset($link['attributes'])) {
- $span_attributes = drupal_attributes($link['attributes']);
- }
- $output .= '' . $link['title'] . '';
+ $items = array();
+
+ foreach ($links as $key => $link) {
+ $class = $key;
+ if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '' && drupal_is_front_page()))) {
+ $class .= ' active';
+ }
+ $items[$key] = array('class' => $class);
+
+ if (isset($link['href'])) {
+ // Pass in $link as $options, they share the same keys.
+ $items[$key]['data'] = l($link['title'], $link['href'], $link);
+ }
+ else if (!empty($link['title'])) {
+ // Some links are actually not links, but we wrap these in for adding title and class attributes
+ if (empty($link['html'])) {
+ $link['title'] = check_plain($link['title']);
+ }
+ $span_attributes = '';
+ if (isset($link['attributes'])) {
+ $span_attributes = drupal_attributes($link['attributes']);
}
-
- $i++;
- $output .= "
\n";
+ $items[$key]['data'] = '' . $link['title'] . '';
}
-
- $output .= '
';
}
-
- return $output;
+ return theme('item_list', $items, NULL, 'ul', $attributes);
}
/**