By stevy99 on
I'm currently trying to create a custom module that expands menu items according to the role of the user. This means I'm editing the menu items after they are fetched from the database tables by using translated_menu_link_alter.
The problem is though, that when I change the expanded option of a specific item, it doesn't get expanded. But when I use the same code to change the title of the item, it works. So I must be doing something wrong. Can you point me in the right direction?
Here is my test code for now:
function ws_mod_expand_menu_per_role_translated_menu_link_alter(&$item, $map) {
if($item['title'] == "Administer") {
$item['expanded'] = "1";
}
}
For example, this works:
function ws_mod_expand_menu_per_role_translated_menu_link_alter(&$item, $map) {
if($item['title'] == "Administer") {
$item['title'] = "Administer123";
}
}
Comments
Did you solve this? Or did
Did you solve this? Or did you find any other solution to expand menu items for some roles only?
Would be very glad about any links or advices...
Adriana