Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In the .install file, there is a handy function called menu_block_fix_custom_menus(). It's invoked on hook_enable.
The problem is that currently the code only allows menu names with the actual word "menu-" in them.
See line 182:
if (!in_array($menu_name, $active_menus) && (strpos($menu_name, 'menu-') === 0)) {
If you are upgrading a site from Drupal 6 to Drupal 7, this is a problem, since your main navigation menu is likely called "primary-links".
Attached patch allows any menu to be set in the menu_default_active_menus variable.
Comment | File | Size | Author |
---|---|---|---|
#1 | allow-all-active-menus-1162956-1.patch | 698 bytes | kostajh |
Comments
Comment #1
kostajh CreditAttribution: kostajh commentedComment #2
mstrelan CreditAttribution: mstrelan commentedStill not working for me. My menu is primary-links, and I ran this function with this patch and get nothing.
Comment #3
kostajh CreditAttribution: kostajh commented@mstrelan: What is the value of your "menu_default_active_menus" variable?
Comment #4
JohnAlbinThis hack was removed since Drupal core is no longer broken.