Menu items created by taxonomy_menu, even when set to "Expanded" still don't show as expanded in the frontend. This is caused by taxonomy_menu messing up the "has_children" column in the menu_links table for menu items it maintains. Specifically, when _taxonomy_menu_nodeapi_helper() is run via a hook_node.
How to recreate the error:
1. Create a new taxonomy term so it appears in the menu (you may need to assign nodes to the term because blank terms don't render in the menu). Do not modify the taxonomy menu link, let the system create it, don't drag items in/out of it, or move it around.
2. Create a new node or edit an existing one, and using the node form, select your newly created taxonomy menu item (which was produced by taxonomy_menu).
3. Visit the frontend and notice that even though "expanded" is checked on your taxonomy menu item, that branch of the tree is not expanded.
This has to do with the fact that even though our taxonomy menu item has a child, the "has_children" row in the database has not been updated.
I think this has to do with the fact that a taxonomy menu item is re-created on node_update, and since it didn't have children before the node was saved, the newly updated/created item after node update also thinks it doesn't have children. When has_children is set to 0 in the database, drupal will not render the menu as expanded even when expanded is set to 1.
I worked around this in my installation by modfying taxonomy_menu.module around line 477, but I doubt this is the best method because I don't understand the totality of the module.
//If the menu item already existed, no need to recreate it.
$previous_item = menu_link_load($args['mlid']);
if(!$previous_item){taxonomy_menu_handler($op, $args, $node);}
This is a pretty aggravating bug, please let me know if anyone requires more details, as I'd love to help get it resolved.
Thanks!
Comments
Comment #1
farse commentedi have this issue as well. tried both assigning the content node to the taxonomy link and also assiging the taxonomy link to the content node link. neither worked. your fix didn't seem to work either. hmm...
menu works fine though if i do neither of these.
Comment #2
farse commentedtry http://drupal.org/project/taxonomy_menu_trails seems to be working now!
Comment #3
dinhtrung commentedI have a simple patch for this issue:
If you attach your node to a sub-menu item of the taxonomy menu, its parent will be displayed as expanded.
Comment #4
hles commentedHardly critical.
Comment #5
johnvWorking through the issue queue: more explicite title.
(keywords: hide, hidden, hiding)
Comment #6
Primajin commentedThis issue is still a problem in 7.x-1.5.
dinhtrung's patch sadly doesn't work for me. The only workaround I found so far is checking "Flatten the taxonomy's hierarchy in the menu". That way the hierarchy get's lost but at least i can see the subnavigation points again.
Please fix this
Comment #7
TannerLavoie commentedThis is still an issue in 7.x-1.5 and dinhrung's patch isn't working for me either. Has anyone found a solution to this?
Comment #8
vladimirausThank you for your contributions.
Drupal 7 is no longer supported.
Closing this issue as outdated.