1 |
87dbc3bf
|
Benjamin Luce
|
<?php
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
function bootstrap_menu_local_action($variables) {
|
11 |
|
|
$link = $variables['element']['#link'];
|
12 |
|
|
|
13 |
|
|
$options = isset($link['localized_options']) ? $link['localized_options'] : array();
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
if (empty($options['html'])) {
|
17 |
|
|
$link['title'] = check_plain($link['title']);
|
18 |
|
|
}
|
19 |
|
|
|
20 |
|
|
$icon = _bootstrap_iconize_button($link['title']);
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
$output = '<li>';
|
24 |
|
|
if (isset($link['href'])) {
|
25 |
|
|
|
26 |
|
|
if ($class = _bootstrap_colorize_button($link['title'])) {
|
27 |
|
|
if (!isset($options['attributes']['class'])) {
|
28 |
|
|
$options['attributes']['class'] = array();
|
29 |
|
|
}
|
30 |
|
|
$string = is_string($options['attributes']['class']);
|
31 |
|
|
if ($string) {
|
32 |
|
|
$options['attributes']['class'] = explode(' ', $options['attributes']['class']);
|
33 |
|
|
}
|
34 |
|
|
$options['attributes']['class'][] = 'btn';
|
35 |
|
|
$options['attributes']['class'][] = 'btn-xs';
|
36 |
|
|
$options['attributes']['class'][] = $class;
|
37 |
|
|
if ($string) {
|
38 |
|
|
$options['attributes']['class'] = implode(' ', $options['attributes']['class']);
|
39 |
|
|
}
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
$options['html'] = TRUE;
|
43 |
|
|
$output .= l($icon . $link['title'], $link['href'], $options);
|
44 |
|
|
}
|
45 |
|
|
else {
|
46 |
|
|
$output .= $icon . $link['title'];
|
47 |
|
|
}
|
48 |
|
|
$output .= "</li>\n";
|
49 |
|
|
|
50 |
|
|
return $output;
|
51 |
|
|
} |