1 |
87dbc3bf
|
Benjamin Luce
|
<?php
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
function theme_bootstrap_btn_dropdown($variables) {
|
11 |
|
|
$type_class = '';
|
12 |
|
|
$sub_links = '';
|
13 |
|
|
|
14 |
|
|
$variables['attributes']['class'][] = 'btn-group';
|
15 |
|
|
|
16 |
|
|
if (isset($variables['type'])) {
|
17 |
|
|
$type_class .= ' btn-' . $variables['type'];
|
18 |
|
|
}
|
19 |
|
|
else {
|
20 |
|
|
$type_class .= ' btn-default';
|
21 |
|
|
}
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
$output = '<div' . drupal_attributes($variables['attributes']) . '>';
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
if (is_array($variables['label'])) {
|
28 |
|
|
$output .= l($variables['label']['title'], $$variables['label']['href'], $variables['label']);
|
29 |
|
|
}
|
30 |
|
|
$output .= '<a class="btn' . $type_class . ' dropdown-toggle" data-toggle="dropdown" href="#">';
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
if (is_string($variables['label'])) {
|
34 |
|
|
$output .= check_plain($variables['label']);
|
35 |
|
|
}
|
36 |
|
|
if (is_array($variables['links'])) {
|
37 |
|
|
$sub_links = theme('links', array(
|
38 |
|
|
'links' => $variables['links'],
|
39 |
|
|
'attributes' => array(
|
40 |
|
|
'class' => array('dropdown-menu'),
|
41 |
|
|
),
|
42 |
|
|
));
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
$output .= '<span class="caret"></span></a>' . $sub_links . '</div>';
|
46 |
|
|
return $output;
|
47 |
|
|
} |