root / drupal7 / sites / all / themes / bootstrap / templates / menu / menu-local-task.func.php @ 1f623f01
1 |
<?php
|
---|---|
2 |
/**
|
3 |
* @file
|
4 |
* Stub file for bootstrap_menu_local_task().
|
5 |
*/
|
6 |
|
7 |
/**
|
8 |
* Returns HTML for a single local task link.
|
9 |
*
|
10 |
* @param array $variables
|
11 |
* An associative array containing:
|
12 |
* - element: A render element containing:
|
13 |
* - #link: A menu link array with 'title', 'href', and 'localized_options'
|
14 |
* keys.
|
15 |
* - #active: A boolean indicating whether the local task is active.
|
16 |
*
|
17 |
* @return string
|
18 |
* The constructed HTML.
|
19 |
*
|
20 |
* @see theme_menu_local_task()
|
21 |
*
|
22 |
* @ingroup theme_functions
|
23 |
*/
|
24 |
function bootstrap_menu_local_task($variables) { |
25 |
$link = $variables['element']['#link']; |
26 |
|
27 |
$options = isset($link['localized_options']) ? $link['localized_options'] : array(); |
28 |
$title = $link['title']; |
29 |
$href = $link['href']; |
30 |
$attributes = array(); |
31 |
|
32 |
// Add text to indicate active tab for non-visual users.
|
33 |
if (!empty($variables['element']['#active'])) { |
34 |
$options['html'] = TRUE; |
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); |
46 |
} |
47 |
|
48 |
return '<li' . drupal_attributes($attributes) . '>' . l($title, $href, $options) . "</li>\n"; |
49 |
} |