1 |
87dbc3bf
|
Benjamin Luce
|
<?php
|
2 |
eefc2ac0
|
Assos Assos
|
|
3 |
87dbc3bf
|
Benjamin Luce
|
|
4 |
|
|
|
5 |
caf16a48
|
Assos Assos
|
|
6 |
87dbc3bf
|
Benjamin Luce
|
|
7 |
|
|
|
8 |
|
|
|
9 |
caf16a48
|
Assos Assos
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
87dbc3bf
|
Benjamin Luce
|
|
24 |
eefc2ac0
|
Assos Assos
|
function bootstrap_menu_local_action(array $variables) {
|
25 |
87dbc3bf
|
Benjamin Luce
|
$link = $variables['element']['#link'];
|
26 |
7547bb19
|
Assos Assos
|
|
27 |
|
|
$options = isset($link['localized_options']) ? $link['localized_options'] : array();
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
$title = empty($options['html']) ? filter_xss_admin($link['title']) : $link['title'];
|
32 |
|
|
|
33 |
1f623f01
|
Assos Assos
|
$icon = _bootstrap_iconize_text($title);
|
34 |
|
|
$href = !empty($link['href']) ? $link['href'] : FALSE;
|
35 |
87dbc3bf
|
Benjamin Luce
|
|
36 |
|
|
|
37 |
1f623f01
|
Assos Assos
|
if ($href) {
|
38 |
87dbc3bf
|
Benjamin Luce
|
|
39 |
1f623f01
|
Assos Assos
|
if ($class = _bootstrap_colorize_text($title)) {
|
40 |
87dbc3bf
|
Benjamin Luce
|
if (!isset($options['attributes']['class'])) {
|
41 |
|
|
$options['attributes']['class'] = array();
|
42 |
|
|
}
|
43 |
|
|
$string = is_string($options['attributes']['class']);
|
44 |
|
|
if ($string) {
|
45 |
|
|
$options['attributes']['class'] = explode(' ', $options['attributes']['class']);
|
46 |
|
|
}
|
47 |
|
|
$options['attributes']['class'][] = 'btn';
|
48 |
|
|
$options['attributes']['class'][] = 'btn-xs';
|
49 |
caf16a48
|
Assos Assos
|
$options['attributes']['class'][] = 'btn-' . $class;
|
50 |
87dbc3bf
|
Benjamin Luce
|
if ($string) {
|
51 |
|
|
$options['attributes']['class'] = implode(' ', $options['attributes']['class']);
|
52 |
|
|
}
|
53 |
|
|
}
|
54 |
caf16a48
|
Assos Assos
|
|
55 |
|
|
$options['html'] = !empty($options['html']) || !empty($icon) ? TRUE : FALSE;
|
56 |
87dbc3bf
|
Benjamin Luce
|
}
|
57 |
1f623f01
|
Assos Assos
|
|
58 |
|
|
return $href ? l($icon . $title, $href, $options) : $icon . $title;
|
59 |
87dbc3bf
|
Benjamin Luce
|
} |