1
|
<?php
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10
|
function bootstrap_menu_link(array $variables) {
|
11
|
$element = $variables['element'];
|
12
|
$sub_menu = '';
|
13
|
|
14
|
if ($element['#below']) {
|
15
|
|
16
|
|
17
|
if (($element['#original_link']['menu_name'] == 'management') && (module_exists('navbar'))) {
|
18
|
$sub_menu = drupal_render($element['#below']);
|
19
|
}
|
20
|
elseif ((!empty($element['#original_link']['depth'])) && ($element['#original_link']['depth'] == 1)) {
|
21
|
|
22
|
unset($element['#below']['#theme_wrappers']);
|
23
|
$sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
|
24
|
|
25
|
$element['#title'] .= ' <span class="caret"></span>';
|
26
|
$element['#attributes']['class'][] = 'dropdown';
|
27
|
$element['#localized_options']['html'] = TRUE;
|
28
|
|
29
|
|
30
|
|
31
|
$element['#localized_options']['attributes']['data-target'] = '#';
|
32
|
$element['#localized_options']['attributes']['class'][] = 'dropdown-toggle';
|
33
|
$element['#localized_options']['attributes']['data-toggle'] = 'dropdown';
|
34
|
}
|
35
|
}
|
36
|
|
37
|
|
38
|
if (($element['#href'] == $_GET['q'] || ($element['#href'] == '<front>' && drupal_is_front_page())) && (empty($element['#localized_options']['language']))) {
|
39
|
$element['#attributes']['class'][] = 'active';
|
40
|
}
|
41
|
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
|
42
|
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
|
43
|
}
|