The module currently is hardcoded to only work with the Main links (default: Main menu) and the Secondary links (default: User menu). Expand it to be able to work off all menus.

Comments

webankit’s picture

+1

webankit’s picture

Support Menu Block to make this module more useful

palmaross’s picture

register

damienmckenna’s picture

damienmckenna’s picture

brant’s picture

I'm looking at this in 7.x-1.0-rc2 -- what if (in the neighborhood of line menu_minipanels.module line 464) we do something like:

  $menu_names = menu_get_names();
  foreach( $menu_names as $menu_name ){
    menu_minipanels_prepare_links(menu_navigation_links($menu_name));
  }

Seems to have caught my custom menus, but don't know if this is overkill (or would catch all cases). Maybe there's more to this issue than I'm seeing at a quick glance?

HTH.

damienmckenna’s picture

What I'm intending to do is have a settings page to let you choose which menus will be available to Menu_MiniPanels, with it defaulting to the Primary and Secondary menus to imitate the way it currently works. I'm aiming to do this next week-ish, I've got a Nodewords release to do first :)

brant’s picture

I totally defer to your judgement, but if my hack in #6 (or similar) would just "make it work," perhaps it would be better to avoid adding settings? As I mentioned, though, I've not much clue if there's a potential performance penalty or other considerations here, so just a thought.

In any case -- thanks for your work. I'll be happy to test whatever you come up with against our use case at the very least.

brant’s picture

Well, it turns out that calling menu_get_names() in #6 tickles this bug in core:

http://drupal.org/node/1020364

...oddly enough, only on pages that aren't in a menu (at least for me).

So, the settings page approach is sounding pretty good at the moment... :)

For now, I've just hard-coded my particular menu name in a call to:

menu_minipanels_prepare_links(menu_navigation_links('my-custom-menu-name'));

bryancasler’s picture

subscribe

Jeff Burnz’s picture

Subscribe.

Jeff Burnz’s picture

I got my own menus working by doing my own hook_page_alter() in my theme, so not hacking the module or anything nasty like that ;)

Update: I made a tutorial explaining how to use the code below, some of my users wanted this which is how I came to this module in the first place, just be aware that you will probably have to remove this at some stage when the module gets updated to support any menu via settings: http://adaptivethemes.com/menu-minipanels-in-adaptivetheme-instant-mega-...

Totally awesome module btw, thanks a lot!

/**
 * Implements hook_page_alter().
 *
 * Add our own menus for Menu Mini Panels.
 *
 * This function does two things:
 * 1. Prepare the links.
 * 2. Build the output.
 */
function adaptivetheme_page_alter(&$page) {
  
  // Add my own menu name, you could make this an array and push it through a loop also...
  $menu = menu_navigation_links('menu-jeff-menu');
  if (!empty($menu)) {
    menu_minipanels_prepare_links($menu);
  }

  // Compile the output of each of the requested MiniPanels.
  $output = '';
  foreach (menu_minipanels_panels(NULL, NULL) as $mlid => $minipanel_name) {
    $output .= '<div class="menu-minipanels menu-minipanel-' . $mlid . '">' . _menu_minipanels_render_panel($minipanel_name) . '</div>';
  }

  if (!empty($output)) {
    $page['page_bottom']['menu_minipanels'] = array(
      '#markup' => $output,
    );
  }
}
eclipsegc’s picture

StatusFileSize
new823 bytes

Patch for anyone who needs this till something better can land.

dman’s picture

Thanks EclipseGc
That helps me out today - looks like a nice small clean patch. May need to check if it has any performance impact by preprocessing all menus now, not just the primary links?

fluffy’s picture

Patch in #13 work for me as well, thank you.

paskainos’s picture

EclipseGc's patch (#13) works! It's the obvious solution (call all menus, not just main & secondary) and should be rolled in.

*Update:* Spoke too soon - the notorious #1020364: Undefined index: localized_options in menu_navigation_links() strikes again! I opted to use @brant's solution (#9) in a custom theme by including this code in template.php:

  // This is a hack to output menu minipanels by hard-wiring
  // custom menus in while addressing this (core bug) issue:
  // http://drupal.org/node/1020364
  // http://drupal.org/node/1199790#comment-5525540
  menu_minipanels_prepare_links(menu_navigation_links('user-menu'));
  menu_minipanels_prepare_links(menu_navigation_links('my-custom-menu'));
ArchangelGuidz’s picture

Confirm that it works too on my end! Great job and thanks! :)

parkej60’s picture

I get the following error when applying the patch.

Notice: Undefined index: localized_options in menu_navigation_links() (line 1858 of ..../includes/menu.inc).

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new12.96 KB
new14.33 KB

Ok, lets try this one out for size. It's a more elaborate version of the idea suggested by EclipseGc that tracks the specific menus that are to be checked for menu_minipanels using a variable; it also includes a hook_update_N() to enable all menus (except 'devel' and 'navigation' menus) along with an update to hook_install() to do the same thing. I'm going to test this some more, but I think it should work. Lastly, I've added a list of menus to the Menu_MiniPanels settings page that shows their status, i.e. whether they can have menu_minipanels added to them. Please take a look and provide feedback, I'm hoping to commit this ASAP :)

damienmckenna’s picture

Updated patches that actually make it ignore the Devel and Navigation menus this time.

damienmckenna’s picture

Status: Needs review » Fixed

I've committed this.

damienmckenna’s picture

Status: Fixed » Needs review
StatusFileSize
new1.46 KB

An update that now doesn't accidentally enable the shortcut sets on D7; this doesn't affect D6.

damienmckenna’s picture

Status: Needs review » Fixed

Committed.

damienmckenna’s picture

Status: Fixed » Needs review
StatusFileSize
new2.54 KB
new3.01 KB

Turns out I had a #facepalm-level faux-pas, these patches resolve the problem.

damienmckenna’s picture

Status: Needs review » Fixed

Committed, and I'll have a new RC out tomorrow-or-so.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Loyer’s picture

Version: 7.x-1.0-beta2 » 7.x-1.1

Is there any more information on supporting all menus?
I have tried answer #12 but get a "Fatal error: Call to undefined function _menu_minipanels_render_panel()" when trying....

SolidSnakeGr’s picture

Issue summary: View changes

Answer #12 points out this error for me :

Fatal error: Call to undefined function menu_minipanels_panels()

Since it is an old issue, I would like to ask if there has been a solution for it yet?

I'm also using AdaptiveThemes.

damienmckenna’s picture

If there's a bug using the module, please open a new issue. Thank you.