I have two menus on the front page of a site I'm working on that needed two menus, one from primary links and one from a custom menu. I set everything up correctly, but I would get a javascript error every time I would try to add a minipanel to the custom menu. A closer look revealed that this module only works with primary or secondary links. I've implemented a hard-coded fix (look below), but I'm not sure how to have the plugin look for ANY custom menus (not just the resources menu I reference below). Thoughts?

Starting at line 60 of menu_minipanels.module:

  // Most themes will call primary and secondary links on every page.
  // They are usually themed by a function call inside page.tpl.php so we can't wait until theme_links is called,
  // because by that time, $closure has already been created, and therefore our code would not be included.
  // Therefore, we ought to load any mini panels primary and secondary links may have.
  $theme_settings = theme_get_settings();
  $primary_links = $theme_settings['toggle_primary_links'] ? menu_primary_links() : array();
  menu_minipanels_preprocess_links_at_init($primary_links);
  $secondary_links = $theme_settings['toggle_secondary_links'] ? menu_secondary_links() : array();
  menu_minipanels_preprocess_links_at_init($secondary_links);
  
  //Added by @kaynenh to use a custom menu
  $custom_menu = menu_navigation_links("menu-resources");
  menu_minipanels_preprocess_links_at_init($custom_menu);

Comments

damienmckenna’s picture

Status: Needs review » Closed (duplicate)

This is a duplicate of #1199790: Support all menus, but I do appreciate the code snippet. I'm aiming to add this feature after the next stable release.

kaynen’s picture

Sorry, didn't see the other issue. The above code should help, but obviously, you won't want it hard-coded.

Michsk’s picture