Drupal Bootstrap – 35 – BONUS: Disable Dropdown Support For Sidebar Menu


In this tutorial we are going to add a menu to the left sidebar without the dropdown function which Bootstrap theme has overridden for all menus. To do this, we will install the Menu block module, override and restore the original theme_menu_link() function for Menu Block module.


Module to install:

Menu Block Documentation:

Theme functions to be overridden:
– [theme]_menu_link__menu_block()

STEPS (Drupal 7):
Step 1: Install and enable the Menu Block module
Step 2: Add a menu block to the primary region
Step 3: Copy original theme_menu_link() function from includesmenu.inc file and paste it to the template.php file located at your sub theme folder. e.g sitesallthemesbootstrap_subthemetemplate.php
Step 4: Update the function name with your sub theme name and apply to menu block. e.g.
bootstrap_subtheme_menu_link__menu_block(). For good practice, you can add a comment to the function.
Step 5: Flush all caches

1. Make sure you replace the [theme] name with your sub theme name correctly. Earlier we created a sub theme called “bootstrap subtheme” and hence the function name should be bootstrap_subtheme_menu_link__menu_block()

2. Make sure you flush all caches


– Install and enable the Menu Block module
– Go to Block layout (Structure -} Block Layout), place a “Main navigation” block under “Primary” region
– Under “HTML AND STYLE OPTIONS” – “Theme hook suggestion”, replace “main” with “menu_block” (though you can rename any name you like) and save blocks
– Go to coremodulessystemtemplatesmenu.html.twig and copy this file.
– Go to your sub theme and paste the file inside templates folder
e.g themesyour_theme_nametemplatesmenu.html.twig.
– rename this twig file “menu” to “menu–menu_block” (Take note of the two Dashes and Underscore).
e.g themesyour_theme_nametemplatesmenu–menu_block.html.twig
– Flush caches and done!

-Basically what happen here is you create a new theme hook suggestion and override the menu.html.twig for menu block you created.
-You can reuse the same theme hook suggestion – “menu_block” as many as you like for other menu blocks you created. They will all pick up from the same “menu–menu_block.html.twig”



  1. Hi, the video tutorial is great and thank you for it. I would like to ask whether it is possible to activate the color buttons on Drupal 8, as in the video when turning on the modules. Thank you

  2. Thank you so much for this. You just helped me solve a very frustrating problem. I like the default Drupal behavior much better for my needs. 🙂

  3. Hi, great tutorial! I'm trying to only show the sub menu items of an active trail and to hide all other sub menus. Without doing this my menu will be huge.

    Thanks mate.

  4. Thanks so much for all the tuts! I just went through all 35 in the past 2 days as a refresher for a large Bootstrap based extranet I am developing for a client. Do you have an opinion of Panelizer vs Display Suite?

  5. Just perfect! One more great drupal video! why don't you have your own website? Honestly I would pay you if you would have full online class. Is there any way to contact you for some help (not for free) 'cause for me Drupal is like programming language, you know the tools but most often don't know how to use them correctly to achieve what you want. And it is hard to find answers online. Anyway, waiting for new videos!

  6. Thank you very much for this videos! They're very helpful.
    Most concise and clear information about drupal bootstrap theme around youtube.

  7. another great video mate ! you are the best. Can you make a video for google map module and animated sidebar menu please ?


Please enter your comment!
Please enter your name here