summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-11-08 12:30:35 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-11-08 12:30:35 +0000
commit641306e95c976287a850446b421ab5d9643bf62b (patch)
tree25cd7529897a38896763aad517dfdda7fdc914f8 /includes
parent8b4ac207ca1ea76dc000969314b871aa3f85d343 (diff)
downloadbrdo-641306e95c976287a850446b421ab5d9643bf62b.tar.gz
brdo-641306e95c976287a850446b421ab5d9643bf62b.tar.bz2
#521852 by brandonojc, Everett Zufelt, mgifford, and sun: Provide semantic markup to local tasks to indicate an active task.
Diffstat (limited to 'includes')
-rw-r--r--includes/menu.inc17
1 files changed, 16 insertions, 1 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index 240615450..a527fcdfe 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -1408,7 +1408,22 @@ function theme_menu_link(array $variables) {
*/
function theme_menu_local_task($variables) {
$link = $variables['element']['#link'];
- return '<li' . (!empty($variables['element']['#active']) ? ' class="active"' : '') . '>' . l($link['title'], $link['href'], $link['localized_options']) . "</li>\n";
+ $link_text = $link['title'];
+
+ if (!empty($variables['element']['#active'])) {
+ // Add text to indicate active tab for non-visual users.
+ $active = '<span class="element-invisible">' . t('(active tab)') . '</span>';
+
+ // If the link does not contain HTML already, check_plain() it now.
+ // After we set 'html'=TRUE the link will not be sanitized by l().
+ if (empty($link['localized_options']['html'])) {
+ $link['title'] = check_plain($link['title']);
+ }
+ $link['localized_options']['html'] = TRUE;
+ $link_text = t('!local-task-title !active', array('!local-task-title' => $link['title'], '!active' => $active));
+ }
+
+ return '<li' . (!empty($variables['element']['#active']) ? ' class="active"' : '') . '>' . l($link_text, $link['href'], $link['localized_options']) . "</li>\n";
}
/**