Drupal: How to Rebuild Menu Navigation

Alan Storm picture Alan Storm · Mar 3, 2011 · Viewed 23.1k times · Source

In Drupal 7.0, when I change a routing path/menu from the type MENU_NORMAL_ITEM to the type MENU_CALLBACK, Drupal 7.0 does not remove the item from the menu_links table. I'm not sure if this is a bug or not, but I've filed one with the core team.

With that context in place, is there a way to force Drupal to do a rebuild of all its navigation menus? The bug I've described above is happening even when I clear out Drupal's cache after changing a Menu item.

I know I can rename an individual menu route, clear cache/refresh, and then name the item back to get any individual route/menu link flushed. I'm looking for a single command I can run (or function to call, or set of commands) and know all the menu navigation is up to date without worrying I've hosed some other part of the system by messing with internals.

Does this exist? If you're going to mention drush or devel, you're awesome, but specific instructions on those tools are what I'm after.

Answer

Berdir picture Berdir · Mar 3, 2011

Note that although there are options to rebuild the menu (see the other answers), these might or might not work to clean up issues with menu links.

Rebuilding the menu just rebuilds the menu router items and the menu links as far as they are automatically generated based on the menu router items. There are known issues with that, for example re-parenting menu links (http://drupal.org/node/550254). If menu links have been customized or added manually (or Drupal thinks they have been changed.. ), then these will not be touched.

As mentioned in another question already, the tight coupling between these two systems will probably be changed in D8 so that you will have to declare menu links separatly from menu router items.