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

CommentFileSizeAuthor
#5 menutrail_above_1.patch659 bytesp4trizio
#3 menutrai_above.patch577 bytesrho_

Comments

jmbarlow’s picture

Status: Active » Reviewed & tested by the community

Well spotted. This proposed patch sorts out the problem for me.

(Nice module btw. "Does what is says on the tin")

sun’s picture

Status: Reviewed & tested by the community » Active

There is no patch here.

rho_’s picture

Status: Active » Needs review
StatusFileSize
new577 bytes

Worked great for me, rolled a patch from the menutrails directory. Good catch mdixoncm!

caktux’s picture

Patch didn't apply cleanly but the fix works

p4trizio’s picture

StatusFileSize
new659 bytes

Thanks mdixonc the code is working perfectly.
About the patch at #3 there is one line missing. Here is a modified one (hand made)

sun’s picture

Status: Needs review » Fixed

This was already fixed in the latest development snapshot.

Status: Fixed » Closed (fixed)

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