[development] menu_navigation_links: bug or feature?
matt at ninjitsuweb.com
Tue Jun 8 19:18:37 UTC 2010
I'm running into an issue in Drupal 6 and want to see if anyone else
had experienced this before I dive too deep. Maybe it's a known issue.
I'm using the following in my template.php to generate a third-level
$subpage_links = menu_navigation_links('primary-links',2);
$vars['subpage_nav'] = theme('links', $subpage_links);
This works great in most cases, for example, when the menu tree looks like;
So on node/2, I see links for 'a' and 'b'.
But sometimes the 'landing page' for a section IS the first node in
the section, for example:
Notice node/1 appears twice in this tree, but in this case, the
sub-items for node/1 do not get rendered.
The problem is that menu_navigation_links() calls menu_tree_get_data()
which does not ask for the appropriate menu item, but instead uses
menu_get_item() and it's own logic (SQL queries) to decide which menu
item to look at, and it does so incorrectly.
I'm at a loss how to proceed... There is an evil hack that works:
replace the top level node/1 with a new php-filter node that does a
My other option seems to be to write a custom replacement for
menu_navigation_link() that does the work of menu_tree_get_data() in a
way that works here, but that feels equally wrong.
I'm not even sure if this is a bug I should report, or just an
inherent limitation of the menu system that can't be resolved until we
get a real context system in core.
All the Best,
More information about the development