diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-24 00:34:11 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-24 00:34:11 +0000 |
commit | 61dd88e8b19c54f0b3620db3d367a766a675f913 (patch) | |
tree | 8bd8734a30810cc0344718d1a69c780e33e29e38 /includes | |
parent | b5729a616e8068f806ff6e9b0d107dac53be6fdb (diff) | |
download | brdo-61dd88e8b19c54f0b3620db3d367a766a675f913.tar.gz brdo-61dd88e8b19c54f0b3620db3d367a766a675f913.tar.bz2 |
#364219 follow-up by brandonojc: Commit missing hunk from last patch.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/theme.inc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/includes/theme.inc b/includes/theme.inc index 0ad132f10..fc7216f83 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -1383,17 +1383,37 @@ function theme_status_messages($display = NULL) { * - href: the link URL. If omitted, the 'title' is shown as a plain text item in the links list. * - html: (optional) set this to TRUE if 'title' is HTML so it will be escaped. * Array items are passed on to the l() function's $options parameter when creating the link. + * @param $heading + * An optional keyed array for a heading to precede the links: + * - text: the heading text + * - level: the heading level (e.g. 'h2', 'h3') + * - class: (optional) space-separated classes for the heading + * Headings should be used on navigation menus and any list of links that + * consistently appears on multiple pages. To make the heading invisible + * use class => 'element-invisible'. Do not use 'display:none', which + * removes it from screen-readers and assistive technology. Headings allow + * screen-reader and keyboard only users to navigate to or skip the links. + * See http://juicystudio.com/article/screen-readers-display-none.php + * and http://www.w3.org/TR/WCAG-TECHS/H42.html for more information. * @param $attributes * A keyed array of attributes. * @return * A string containing an unordered list of links. */ -function theme_links($links, $attributes = array('class' => array('links'))) { +function theme_links($links, $heading = array(), $attributes = array('class' => array('links'))) { global $language; $output = ''; if (count($links) > 0) { - $output = '<ul' . drupal_attributes($attributes) . '>'; + $output = ''; + if (!empty($heading['text']) && !empty($heading['level'])) { + $output .= '<' . $heading['level'] . (!empty($heading['class']) ? + drupal_attributes(array('class' => $heading['class'])) : '') . '>'; + $output .= check_plain($heading['text']); + $output .= '</' . $heading['level'] . '>'; + } + + $output .= '<ul' . drupal_attributes($attributes) . '>'; $num_links = count($links); $i = 1; |