Quite a subtle one this. If you have a heirarchical menu structure in which 2 (or more) siblings have children, such as this
- Item 1
-- Child 1
-- Child 2
-- Child 3
- Item 2
-- Child 4
-- Child 5
And you use the menu trails module setting Child5 as the target then the breadcrumb generated will be
Item1 > Item2 > Child 5
NOTE the sibling (item1) appearing whear it shouldn't
I've tracked this down to the _menutrails_recurse_crumbs function, where an array of "above" items is being generated and passed into the recursive function. For each of the top level items, $above is just being added to each time so when you get to the second item $above already contains the first item (if that makes any sense).
Simple solution is to not touch the $above variable - so you end up with something like
if (is_array($menu_item['below'])) {
$new_above = $above; //Don't go changing the $above variable as we need this for the next pass
$new_above[] = $menu_item;
_menutrails_recurse_crumbs($menu_item['below'], $item, $crumbs, $new_above);
}
I'll pop this into a patch in a mo ...
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | menutrail_above_1.patch | 659 bytes | p4trizio |
| #3 | menutrai_above.patch | 577 bytes | rho_ |
Comments
Comment #1
jmbarlow commentedWell spotted. This proposed patch sorts out the problem for me.
(Nice module btw. "Does what is says on the tin")
Comment #2
sunThere is no patch here.
Comment #3
rho_ commentedWorked great for me, rolled a patch from the menutrails directory. Good catch mdixoncm!
Comment #4
caktux commentedPatch didn't apply cleanly but the fix works
Comment #5
p4trizio commentedThanks mdixonc the code is working perfectly.
About the patch at #3 there is one line missing. Here is a modified one (hand made)
Comment #6
sunThis was already fixed in the latest development snapshot.