Revision 1f623f01
Added by Assos Assos almost 8 years ago
drupal7/sites/all/themes/bootstrap/templates/menu/menu-local-task.func.php | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
function bootstrap_menu_local_task($variables) { |
25 | 25 |
$link = $variables['element']['#link']; |
26 |
$link_text = $link['title']; |
|
26 |
|
|
27 |
$options = isset($link['localized_options']) ? $link['localized_options'] : array(); |
|
28 |
$title = $link['title']; |
|
29 |
$href = $link['href']; |
|
27 | 30 |
$attributes = array(); |
28 | 31 |
|
32 |
// Add text to indicate active tab for non-visual users. |
|
29 | 33 |
if (!empty($variables['element']['#active'])) { |
30 |
// Add text to indicate active tab for non-visual users. |
|
31 |
$active = '<span class="element-invisible">' . t('(active tab)') . '</span>'; |
|
32 |
|
|
33 |
// If the link does not contain HTML already, check_plain() it now. |
|
34 |
// After we set 'html'=TRUE the link will not be sanitized by l(). |
|
35 |
if (empty($link['localized_options']['html'])) { |
|
36 |
$link['title'] = check_plain($link['title']); |
|
37 |
} |
|
38 |
$link['localized_options']['html'] = TRUE; |
|
39 |
$link_text = t('!local-task-title!active', array('!local-task-title' => $link['title'], '!active' => $active)); |
|
40 |
|
|
34 |
$options['html'] = TRUE; |
|
41 | 35 |
$attributes['class'][] = 'active'; |
36 |
$title = t('!local-task-title!active', array( |
|
37 |
'!local-task-title' => $title, |
|
38 |
'!active' => '<span class="element-invisible">' . t('(active tab)') . '</span>', |
|
39 |
)); |
|
40 |
} |
|
41 |
|
|
42 |
// Filter the title if the "html" is set, otherwise l() will automatically |
|
43 |
// sanitize using check_plain(), so no need to call that here. |
|
44 |
if (!empty($options['html'])) { |
|
45 |
$title = _bootstrap_filter_xss($title); |
|
42 | 46 |
} |
43 | 47 |
|
44 |
return '<li' . drupal_attributes($attributes) . '>' . l($link_text, $link['href'], $link['localized_options']) . "</li>\n";
|
|
48 |
return '<li' . drupal_attributes($attributes) . '>' . l($title, $href, $options) . "</li>\n";
|
|
45 | 49 |
} |
Also available in: Unified diff
Weekly update of contrib modules