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.
I'm trying to embed a menu block into a panel. The menu block has the following relevant settings:
- Starting level: 2nd Level (secondary)
- Fixed parent item: Blogs - FYI, Blogs is a 1st level menu item.
When I view the page, the menu is blank. When I go back to configure the settings, Fixed parent item is reset back to <My Menu Name>.
This seems like a bug. Let me know what I can do to help fix it.
Comments
Comment #1
Lowkey CreditAttribution: Lowkey commentedFrom what I can tell, the source of this error stems from failing to extract the menu link ID (mlid) from the parent_mlid in menu_tree_build() on line 254 in /path/to/drupal/sites/all/modules/menu_block/menu_block.module.
menu_tree_build() takes $config as parameter and expects it to look like this:
The $config['parent_mlid'] is expected to be an int, but is really a string that follows the pattern $menu_name:parent_mlid, for example main-menu:1128.
This becomes a problem when we get to line 325 in /path/to/drupal/sites/all/modules/menu_block/menu_block.module :
The function menu_link_load(), found in /path/to/drupal/includes/menu.inc expects an integer :
A hotfix would be to replace line 328 in /path/to/drupal/sites/all/modules/menu_block/menu_block.module :
with these :
To have the set Fixed parent item show up, when you go back to configure the settings, line 429 in /path/to/drupal/sites/all/modules/menu_block/menu_block.admin.inc should be changed from
to
It probably takes a little more refactoring for the issue to be completely solved.
I'm using the module with Panopoly and I still need to figure out, how to set a fixed parent item that shows one level of children, while also showing the siblings of the parent.
Comment #2
caschbre CreditAttribution: caschbre commented@Lowkey... I tried the hotfix you suggested but I'm still not able to
a) get Menu setting to retain a selected menu. It always reverts back to
.
b) get Fixed parent item to list anything other than
, let alone retain any setting.
Have you come across anything that resolves the issue?
Comment #3
JohnAlbinI can't reproduce.
Comment #4
webadpro CreditAttribution: webadpro commentedI'm actually facing the same problem. The parent item is never saved.
Comment #5
fredsted CreditAttribution: fredsted commentedSame here, webadpro. How come this issue is closed? Due to this I have to create a custom menu for each page. It's a nightmare to maintain.
Edit: This thread was referenced in the panopoly widgets module, didn't think it was the menu block module...I don't know if it's panopoly or this that is causing this