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

Mark Trapp’s picture

Category: feature » support
Status: Active » Closed (works as designed)

Context: 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.

doublejosh’s picture

Thanks.

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...

MENU_BLOCK_TYPE_MODULE_block($op, $delta, $edit) {
  switch($op) {
    case 'view' :
      if(module_exists('context_menu_block')) _context_menu_block_set_active_trails();
      // carry on with block creation...
    break;
  }
}

Think I'll cross link to see if GigaMenu is interested in preserving active trails. I know I am while using it.

Mark Trapp’s picture

I 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.

doublejosh’s picture

For sure!

Thanks for the advice. I'll see if that solves it for me.