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 was hoping to borrow the technique used in this module (since I found it from the issue que where the snippet was posted) to set active menu context conditions for use in another menu based block module called GigaMenu
It also relies on ['in_active_trail']
which is not set by context. I imagine there are a number of other modules like MegaMenu and NiceMenu that might make use of this.
Didn't seem to work with GigaMenu. Advise?
Comments
Comment #1
Mark TrappContext: Menu Block relies on
hook_menu_block_tree_alter()
, a hook only Menu Block provides. You might want to file a feature request with other modules to see if they can support the active menu context.Comment #2
doublejosh CreditAttribution: doublejosh commentedThanks.
I just thought that perhaps this module could set and help out other module that rely on
['in_active_trail']
regardless of menu block.But thinking about it again, I suppose you really need to hook into when that module it creating it's block and then ensure active trails are set.
Perhaps this module could provide a function for other modules to use to set active trails while creating their blocks.
They could add something like...
Think I'll cross link to see if GigaMenu is interested in preserving active trails. I know I am while using it.
Comment #3
Mark TrappI don't see the need to re-implement a hook that already exists: if GigaMenu were to use the
hook_menu_block_tree_alter()
alter hook when building its menus, it would gain the effects of Context: Menu Block and other modules that implement the hook for free.However, ideally GigaMenu (and Menu Block) would add native context support and bridge modules like Context: Menu Block would not be needed. Supporting every new menu module that comes up is really outside the scope of this project.
Comment #4
doublejosh CreditAttribution: doublejosh commentedFor sure!
Thanks for the advice. I'll see if that solves it for me.