Use menus in Drupal 7? You need Menu block module.

By John, 11 January, 2011

This was originally published on http://www.palantir.net/blog/use-menus-drupal-7-you-need-menu-block-module

Drupal 7.0 is out! And while we managed to get all the critical bugs fixed before it was released, there's still a handful of major bugs that we weren't able to fix. One of those bugs affects Drupal's menus: Custom menus never receive an active trail. Oops.

Hey! If this link is active, why isn't it expanded?
Custom menus in Drupal 7.0

So if you are using a menu you created yourself with the "Add menu" link on the Menu administration page (admin/structure/menu), that menu won't work properly in Drupal 7.0. If you visit any of the top-level pages in that menu, none of them will expand to show you their child links. This is really bad.

There's also a several related symptoms of this bug. Did you just enable the Contact module and create a link to it underneath another item in your Main menu? Well, it won't ever be in the active trail because the Contact-module-provided "Contact" link that is hiding in the Navigation menu will only ever be the active trail. And if you want to provide two different paths to the same item in two different menus? That, too, won't fly under Drupal 7.0.

Fortunately, Menu block module version 7.x-2.0 was released this week with a work-around for this bug. So if you want to ensure your menus work properly under Drupal 7.0, make sure you download the new version of Menu block.

Open source solutions come from many, many people

I'm just trying to get the word out about this bug as its not particularly easy to understand or diagnose. And, while I've spent a few hours trying to fix this problem, there were many others that deserve mention.

Our own Bec White was the first to diagnose this bug after Greg Leroux first spotted it. With code from Bec, Matt Farina, and Commerce Guys' Damien Tournoud, I managed to craft (or more accurately, hack) a work-around for this bug: #1017122 and #1017142.

And, yes, I am working with others on a proper patch for Drupal core. Hopefully, the fix will be incorporated into Drupal 7.1. In the meantime, I hope you'll discover how awesomely flexible the Menu block module is and keep it around even after the core bug is fixed.

Its important to share your ideas, code and problems in an Open Source community. Because that's how things get done.

Topics: Drupal, Information Architecture (IA)

Comments