From 641306e95c976287a850446b421ab5d9643bf62b Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sun, 8 Nov 2009 12:30:35 +0000 Subject: #521852 by brandonojc, Everett Zufelt, mgifford, and sun: Provide semantic markup to local tasks to indicate an active task. --- includes/menu.inc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'includes') 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 '' . l($link['title'], $link['href'], $link['localized_options']) . "\n"; + $link_text = $link['title']; + + if (!empty($variables['element']['#active'])) { + // Add text to indicate active tab for non-visual users. + $active = '' . t('(active tab)') . ''; + + // 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 '' . l($link_text, $link['href'], $link['localized_options']) . "\n"; } /** -- cgit v1.2.3