root / drupal7 / sites / all / themes / bootstrap / templates / menu / menu-local-task.func.php @ 1f623f01
1 | 87dbc3bf | Benjamin Luce | <?php
|
---|---|---|---|
2 | /**
|
||
3 | * @file
|
||
4 | caf16a48 | Assos Assos | * Stub file for bootstrap_menu_local_task().
|
5 | 87dbc3bf | Benjamin Luce | */
|
6 | |||
7 | /**
|
||
8 | caf16a48 | Assos Assos | * 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 | 87dbc3bf | Benjamin Luce | */
|
24 | function bootstrap_menu_local_task($variables) { |
||
25 | $link = $variables['element']['#link']; |
||
26 | 1f623f01 | Assos Assos | |
27 | $options = isset($link['localized_options']) ? $link['localized_options'] : array(); |
||
28 | $title = $link['title']; |
||
29 | $href = $link['href']; |
||
30 | caf16a48 | Assos Assos | $attributes = array(); |
31 | 87dbc3bf | Benjamin Luce | |
32 | 1f623f01 | Assos Assos | // Add text to indicate active tab for non-visual users.
|
33 | 87dbc3bf | Benjamin Luce | if (!empty($variables['element']['#active'])) { |
34 | 1f623f01 | Assos Assos | $options['html'] = TRUE; |
35 | caf16a48 | Assos Assos | $attributes['class'][] = 'active'; |
36 | 1f623f01 | Assos Assos | $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 | 87dbc3bf | Benjamin Luce | } |
47 | |||
48 | 1f623f01 | Assos Assos | return '<li' . drupal_attributes($attributes) . '>' . l($title, $href, $options) . "</li>\n"; |
49 | 87dbc3bf | Benjamin Luce | } |