Since dropdown submenus no longer exist in Bootstrap 3 (http://stackoverflow.com/questions/18023493/bootstrap-3-dropdown-sub-men...), the code for bootstrap_menu_link in ../theme/menu/menu-link.func.php is obsolete.

ref: http://getbootstrap.com/components/#nav-dropdowns

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

el7cosmos’s picture

Not just the class then, submenu shouldn't be rendered also

el7cosmos’s picture

Issue summary: View changes

edit.

el7cosmos’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
1.81 KB
ShaunDychko’s picture

Issue summary: View changes
FileSize
1.98 KB

Thanks el7cosmos, that works! I also removed the data-target attribute since that's also obsolete.

valkum’s picture

+++ b/theme/menu/menu-link.func.php
@@ -11,7 +11,7 @@ function bootstrap_menu_link(array $variables) {
+  if ($element['#below'] && $element['#original_link']['depth'] == 1) {
     // Prevent dropdown functions from being added to management menu so it
     // does not affect the navbar module.
     if (($element['#original_link']['menu_name'] == 'management') && (module_exists('navbar'))) {
@@ -21,24 +21,11 @@ function bootstrap_menu_link(array $variables) {

@@ -21,24 +21,11 @@ function bootstrap_menu_link(array $variables) {
       // Add our own wrapper.

we should move depth == 1 further down. Because of the navbar module exclusion.

data-target should be set i think. See comment above the data-target line.

valkum’s picture

What do you think about this patch?

el7cosmos’s picture

Thats nice @valkum
I'll go with #5, and yes, data-target should be set

markhalliwell’s picture

Status: Needs review » Fixed

Thanks @valkum!

Committed a8cefe4 to 7.x-3.x:

Issue #2122539 by valkum, Shaun Dychko, el7cosmos: Sub menus no longer exist in Bootstrap 3: obsolete code in bootstrap_menu_link().

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

drumm’s picture

Issue summary: View changes
hkirsman’s picture

So could somebody explain why Bootstrap still has submenus: http://getbootstrap.com/components/#navbar-default ?

hkirsman’s picture

Just asked the Bootstrap guys and there is 1 level submenu:
https://github.com/twbs/bootstrap/issues/14944

Just that nesting does not work.

cdonner’s picture

I believe it has been shown that this issues was caused by a semantic misunderstanding and that submenus still exist in Bootstrap, albeit only one level down from the nav bar. Is there a plan to restore this functionality in the Drupal theme?

markhalliwell’s picture

This issue was about removing the .dropdown-submenu support (see the patch). It did not take out dropdown menu from the main nav links at all.

Top level menu item .nav li a
-- Dropdown menu item .nav li .dropdown li a
---- Sub menu item .nav li .dropdown li .dropdown-submenu li a (this is what was removed in BS3)

Is there a plan to restore this functionality in the Drupal theme?

This project attempts to keep parity with the BS framework. So no, not unless BS itself decides to put them back in. This is, however, very unlikely to happen:

"We haven't seen anyone using submenus in meaningful ways and the code necessary to make them work well is just too much overhead. Submenus just don't have much of a place on the web right now, especially the mobile web. They will be removed with 3.0." - @mdo

The link in the issue summary (http://stackoverflow.com/a/18024991/1226717), provides examples for how to accomplish this manually in your sub-theme. Furthermore, one can easily reverse engineer the patch in #5 to restore the previous functionality if necessary.

murthi9772’s picture

-

murthi.karuppan’s picture

.

murthi.karuppan’s picture

Note: Replace all THEMENAME implementations with the machine name of your sub-theme.

  1. Create a CDN starterkit sub-theme.
  2. Download and extract SmartMenus jQuery plugin.
  3. Copy jquery.smartmenus.bootstrap.css to ./THEMENAME/css/jquery.smartmenus.bootstrap.css.
  4. Copy jquery.smartmenus.js to ./THEMENAME/js/jquery.smartmenus.js.
  5. Copy jquery.smartmenus.bootstrap.js to ./THEMENAME/js/jquery.smartmenus.bootstrap.js.
  6. Add the following in your THEMENAME.info file:
    stylesheets[all][] = css/jquery.smartmenus.bootstrap.css
    scripts[] = 'js/jquery.smartmenus.js'
    scripts[] = 'js/jquery.smartmenus.bootstrap.js'
    
  7. In your sub-theme's template.php file (or dedicated ./THEMENAME/templates/menu/menu-link.func.php file) add the following code: http://pastebin.com/2N3m5FBp
  8. Clear all caches.

*edited for brevity and clearer instructions

markhalliwell’s picture

@murthi.karuppan, please stop spamming all three issues with super long and unnecessarily verbose posts.