I get an error with both beta2 and dev versions:

Warning: Invalid argument supplied for foreach() in i18nmenu_localize_tree() (line 114 of sites/all/modules/i18n/i18nmenu/i18nmenu.module)

Call stack:

.i18nmenu_localize_tree(a:2:{i:0;N;i:1;b:0;})[i18nmenu.module:133];
..i18nmenu_localize_tree(array)[i18nmenu.module:133];
...i18nmenu_localize_tree(array)[i18nmenu.module:133];
....i18nmenu_localize_tree(array)[megamenu.module:174];
.....theme_megamenu_menu_tree(a:1:{i:0;s:12:"menu-hobbies";})[?:?];
......call_user_func_array(a:2:{i:0;s:24:"theme_megamenu_menu_tree";i:1;a:1:{i:0;s:12:"menu-hobbies";}})[theme.inc:668];
.......theme(a:2:{i:0;s:18:"megamenu_menu_tree";i:1;s:12:"menu-hobbies";})[megamenu.module:123];
........megamenu_block(a:2:{i:0;s:4:"view";i:1;s:1:"1";})[?:?];
.........call_user_func_array(a:2:{i:0;s:14:"megamenu_block";i:1;a:2:{i:2;s:4:"view";i:3;s:1:"1";}})[module.inc:461];
..........module_invoke(a:4:{i:0;s:8:"megamenu";i:1;s:5:"block";i:2;s:4:"view";i:3;s:1:"1";})[block.module:529];
...........block_list(a:1:{i:0;s:6:"header";})[theme.inc:1641];
............theme_blocks(a:1:{i:0;s:6:"header";})[?:?];
.............call_user_func_array(a:2:{i:0;s:12:"theme_blocks";i:1;a:1:{i:0;s:6:"header";}})[theme.inc:668];
..............theme(a:2:{i:0;s:6:"blocks";i:1;s:6:"header";})[theme.inc:1835];
...............template_preprocess_page(array)[?:?];
................call_user_func_array(array)[theme.inc:709];
.................theme(array)[index.php:35];
..................index.php

Comments

alexbk66-’s picture

I've got it, you can see from the call stack, my taxonomy has more than three levels. So the third level item with children ($item['below'] !== FALSE) doesn't actually have the children when returned from _megamenu_get_menu_tree().

_megamenu_get_menu_tree() is pretty messy with 3 levels of copy&paste and really should be refactored. No wonder it has bugs (http://drupal.org/node/1198932). It should really use nested call similar to i18nmenu_localize_tree().

And it should issue a warning if there's more than menu 3 levels.

I can give it a shot, but I'm not a Drupal or PHP expert.

alexbk66-’s picture

I'm not sure what _megamenu_get_menu_tree() does? Just removes hidden items from tree returned by menu_tree_all_data()?
Why not just use menu_tree_page_data() which I assume doesn't have hidden items?

alexbk66-’s picture

Ok, here's the much cleaner _megamenu_get_menu_tree() function. Please review.

It fixes this issue, note $item[$tier_key]['below'] = FALSE;

Plus makes changing the number of levels easy (Should even make it configurable by menu). After similar improvement in megamenu_theme_menu_tree(). #886652: Can I add an extra degree of depth/nesting to the megamenu?

[EDIT]
Moved to #1205068: Refactored theme_megamenu_menu_tree(), multiple fixes.

Anonymous’s picture

Status: Active » Needs review
Anonymous’s picture

Assigned: Unassigned »
Issue tags: +multifix