Closed (fixed)
Project:
OM 2 HTML5
Version:
6.x-1.9
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Jun 2011 at 13:26 UTC
Updated:
2 Aug 2011 at 00:22 UTC
So, let's say I use template.php to override a primary link with some code. Say I want the href or title to be different based on a user. Well, the primary_links array reflects it, but primary_tree does not. Even if I attempt this over-ride in page.tpl.php, same thing happens. Relevant code:
In template.php
if (in_array(somerole', $user->roles)) {
$vars['primary_links']['menu-xyz']['href']='path/to/somewhere'
}In page.tpl.php
print om_menu('main-menu', $primary_links, $primary_links_tree);
This prints the tree, and does not reflect what is in $primary_links
Comments
Comment #1
danielhonrade commentedHi Steve,
Maybe you can override the $vars['primary_links_tree] instead:
Comment #2
stkrzysiak commentedDaniel,
That works, but then what is the point of the function accepting both variables? Do each serve a purpose?
Thanks
Comment #3
danielhonrade commentedHi Steve,
If I remember it right, I think, I couldn't turn off the the menu links when the theme settings is unchecked using the $primary_links_tree because it's raw, so I also need $primary_links variable for on/off purposes.
And the $primary_links_tree has all the submenus, unlike the $primary_link which has only the top level menu.
Comment #4
danielhonrade commented