summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandregriffin2013-03-23 20:55:35 (GMT)
committer andregriffin2013-03-23 20:55:35 (GMT)
commit48b0b01fbd35de70839c5113fc93a7d912fb70b5 (patch)
tree187c3ea4bc6d9377a4ad9a3dc2cd3050ce4a3a77
parentcc016cca6e2cdc06378eabc17f6dec4a8b2565c9 (diff)
Issue #1940080 by andregriffin, wundo: Resolve conflict with navbar module
-rw-r--r--includes/menu.inc48
1 files changed, 26 insertions, 22 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index 6352937..d04cb49 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -61,32 +61,36 @@ function bootstrap_menu_link(array $variables) {
$sub_menu = '';
if ($element['#below']) {
- // Ad our own wrapper
- unset($element['#below']['#theme_wrappers']);
- $sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
- $element['#localized_options']['attributes']['class'][] = 'dropdown-toggle';
- $element['#localized_options']['attributes']['data-toggle'] = 'dropdown';
-
- // Check if this element is nested within another
- if ((!empty($element['#original_link']['depth'])) && ($element['#original_link']['depth'] > 1)) {
- // Generate as dropdown submenu
- $element['#attributes']['class'][] = 'dropdown-submenu';
+
+ // Prevent dropdown functions from being added to management menu as to not affect navbar module.
+ if (($element['#original_link']['menu_name'] == 'management') && (module_exists('navbar'))) {
+ $sub_menu = drupal_render($element['#below']);
}
+
else {
- // Generate as standard dropdown
- $element['#attributes']['class'][] = 'dropdown';
- $element['#localized_options']['html'] = TRUE;
- $element['#title'] .= '<span class="caret"></span>';
- }
+ // Add our own wrapper
+ unset($element['#below']['#theme_wrappers']);
+ $sub_menu = '<ul class="dropdown-menu">' . drupal_render($element['#below']) . '</ul>';
+ $element['#localized_options']['attributes']['class'][] = 'dropdown-toggle';
+ $element['#localized_options']['attributes']['data-toggle'] = 'dropdown';
- // Set dropdown trigger element to # to prevent inadvertant page loading with submenu click
- $element['#localized_options']['attributes']['data-target'] = '#';
- }
- // Issue #1896674 - On primary navigation menu, class 'active' is not set on active menu item.
- // @see http://drupal.org/node/1896674
- if (($element['#href'] == $_GET['q'] || ($element['#href'] == '<front>' && drupal_is_front_page())) && (empty($element['#localized_options']['language']) || $element['#localized_options']['language']->language == $language_url->language)) {
- $element['#attributes']['class'][] = 'active';
+ // Check if this element is nested within another
+ if ((!empty($element['#original_link']['depth'])) && ($element['#original_link']['depth'] > 1)) {
+ // Generate as dropdown submenu
+ $element['#attributes']['class'][] = 'dropdown-submenu';
+ }
+ else {
+ // Generate as standard dropdown
+ $element['#attributes']['class'][] = 'dropdown';
+ $element['#localized_options']['html'] = TRUE;
+ $element['#title'] .= ' <span class="caret"></span>';
+ }
+
+ // Set dropdown trigger element to # to prevent inadvertant page loading with submenu click
+ $element['#localized_options']['attributes']['data-target'] = '#';
+ }
}
+
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}