1
|
<?php
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11
|
|
12
|
|
13
|
|
14
|
|
15
|
|
16
|
|
17
|
|
18
|
|
19
|
|
20
|
|
21
|
function bootstrap_menu_link(array $variables) {
|
22
|
$element = $variables['element'];
|
23
|
$sub_menu = '';
|
24
|
|
25
|
if ($element['#below']) {
|
26
|
|
27
|
|
28
|
if (($element['#original_link']['menu_name'] == 'management') && (module_exists('navbar'))) {
|
29
|
$sub_menu = drupal_render($element['#below']);
|
30
|
}
|
31
|
elseif ((!empty($element['#original_link']['depth'])) && ($element['#original_link']['depth'] == 1)) {
|
32
|
|
33
|
unset($element['#below']['#theme_wrappers']);
|
34
|
$sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
|
35
|
|
36
|
$element['#title'] .= ' <span class="caret"></span>';
|
37
|
$element['#attributes']['class'][] = 'dropdown';
|
38
|
$element['#localized_options']['html'] = TRUE;
|
39
|
|
40
|
|
41
|
|
42
|
$element['#localized_options']['attributes']['data-target'] = '#';
|
43
|
$element['#localized_options']['attributes']['class'][] = 'dropdown-toggle';
|
44
|
$element['#localized_options']['attributes']['data-toggle'] = 'dropdown';
|
45
|
}
|
46
|
}
|
47
|
|
48
|
|
49
|
if (($element['#href'] == $_GET['q'] || ($element['#href'] == '<front>' && drupal_is_front_page())) && (empty($element['#localized_options']['language']))) {
|
50
|
$element['#attributes']['class'][] = 'active';
|
51
|
}
|
52
|
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
|
53
|
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
|
54
|
}
|
55
|
|
56
|
|
57
|
|
58
|
|
59
|
function bootstrap_menu_link__book_toc(array $variables) {
|
60
|
$element = $variables['element'];
|
61
|
$sub_menu = drupal_render($element['#below']);
|
62
|
$element['#attributes']['role'] = 'presentation';
|
63
|
$link = TRUE;
|
64
|
if ($element['#title'] && $element['#href'] === FALSE) {
|
65
|
$element['#attributes']['class'][] = 'dropdown-header';
|
66
|
$link = FALSE;
|
67
|
}
|
68
|
elseif ($element['#title'] === FALSE && $element['#href'] === FALSE) {
|
69
|
$element['#attributes']['class'][] = 'divider';
|
70
|
$link = FALSE;
|
71
|
}
|
72
|
elseif (($element['#href'] == $_GET['q'] || ($element['#href'] == '<front>' && drupal_is_front_page())) && (empty($element['#localized_options']['language']))) {
|
73
|
$element['#attributes']['class'][] = 'active';
|
74
|
}
|
75
|
if ($link) {
|
76
|
$element['#title'] = l($element['#title'], $element['#href'], $element['#localized_options']);
|
77
|
}
|
78
|
return '<li' . drupal_attributes($element['#attributes']) . '>' . $element['#title'] . $sub_menu . "</li>\n";
|
79
|
}
|