First, thanks again for this great module, and sorry if this is covered somewhere else-- I searched but did not find.

My issue is with the little triangle icon next to my menu items that have only menu position rule children (by definition, disabled). My menu block menu is showing the menu link with the expanded, downward-pointing triangle (rather than the dot) but there are no enabled menu items below it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JohnAlbin’s picture

Yeah, I see that too. But only with menu_block module blocks, not with core menu.module blocks.

JohnAlbin’s picture

This behavior has changed now that #1019342: Add current page's menu link at the end of the active trail has landed.

Hmm…

Here's the tree when a rule's parent item isn't the active link:

Here's the tree when a rule's parent item is the active link:

And here's the tree when a rule is active:

I can tackle the problem on the menu_block side, but I'm not sure if I can on the menu.module block side.

JohnAlbin’s picture

Title: Menu links with menu position rule children are shown as expandable » Parent menu link of rule shows wrong expand/leaf icon
Status: Active » Fixed

Fixed!

I figured out how to dynamically alter the parent menu links to toggle the "has_children" flag when the rule is active. Which means the parent menu link will show as a "leaf" when it is not in the active trail and when it is the active menu item. And will show as "expanded" when its child rule is active.

Yayz!

Actually the "Here's the tree when a rule's parent item is the active link" picture in #2 above of the menu_block block is still the same; its still showing as "expanded" when the parent menu link is the active menu item. But that is a bug in menu_block module; I'll have to open up an issue in that queue.

quartsize’s picture

Status: Fixed » Needs work

The update hook introduced with this fix appears to generate the warning

unserialize() expects parameter 1 to be string, array given menu.inc:2965

for every enabled menu position rule.

This can be reproduced by installing with the Standard profile, enabling menu_position-7.x-1.0-beta2, creating some rules, and upgrading to menu_position-7.x-1.0-beta3.

JohnAlbin’s picture

Bah. It looks like menu_link_save() has a bug in it. It assumes that the $existing_item parameter has a serialized options array item, which is just plain stupid.

The easy fix for this is to remove the $existing_item parameter and just let menu_link_save() do a db query to retrieve the existing item. That sucks since we already have the existing item out of the db, but since this work is only done on update or in the admin section, its not too bad.

Thanks for the bug report, quartsize! :-)

JohnAlbin’s picture

Status: Needs work » Needs review
FileSize
1.1 KB

Here's a patch.

JohnAlbin’s picture

Well, that fixes the bug, but not the update. :-p

/me tries again.

JohnAlbin’s picture

The update path is more seriously broken then I realized. I'm fixing it over in #1305546: All rules are broken after upgrade to 7.x-1.0-beta3.

Here's a new patch.

JohnAlbin’s picture

Status: Needs review » Fixed

Fixed.

Status: Fixed » Closed (fixed)

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