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 hook_block_view
the menu name in $config['menu_name'] ends up being '_active', which is incorrect, when 'Menu selected by active page' is selected for the block configuration, This prevents the proper context links from being added to the block itself and one cannot access the manage menu/book outline from the block. Use $data['content']['#config']['menu_name']
's value instead.
Comments
Comment #1
JohnAlbinThe title of an issue should be a succinct summary of the issue. Note that the issue summary no longer has sufficient information now that I've changed the title.
I feel like you know what the proper fix for this is, but you haven't given enough information. Where does menu_block need to “Use $data['content']['#config']['menu_name'] instead of $config['menu_name']”?
Comment #1.0
hazah CreditAttribution: hazah commentedChanged description to better describe the issue.
Comment #2
hazah CreditAttribution: hazah commentedMy apologies, I'm still a bit of a newb when it comes to these forums. Yes, I've patched this up for myself by changing
hook_block_view()
to read the data variable rather than the config. I didn't make a patch file for it but the change is fairly strait forward. Thanks!Comment #3
JohnAlbinOh! I see.
Comment #4
JohnAlbinActually, there's a simpler solution. Since
menu_tree_build($config)
is altering the menu_name part of the config why not let it alter the original configuration using&
?Fixed! http://drupalcode.org/project/menu_block.git/commitdiff/3b13bfd
Comment #5
hazah CreditAttribution: hazah commentedThanks!
Comment #6.0
(not verified) CreditAttribution: commentedAdded more info.