By dsnoeck on
Hello
I would like to create a dynamic menu in function of values which are contain in the profile_values table. I'm searching a way to define the parent item in hook_menu where I would like to place this item. I cannot do this manually because I don't know which values will be in the Database. By default all item go into the default menu "Navigation" and I would like to place it in a custom menu "Application".
This code display the item in "Navigation":
$items[] = array(
'title' => t('Human Resources'),
'path' => 'hr',
'access' => 'TRUE'
);
Is it possible to place this item in the parent item called "Application" like this ?
$items[] = array(
'title' => t('Human Resources'),
'path' => 'Application', 'hr',
'access' => 'TRUE'
);
Cheers,
Damien
----------------
Keep Open Spirit
Comments
On the menu administration
On the menu administration page, you can change the "Human Resources" item to be displayed in the "Application" menu. All children of "Human Resources" (i.e.
'path'=> 'hr/whatever') will then still be displayed as children of "Human Resources".I hope this helps.
--
~/.singatrue: file not found
More precisions
Thanks for the proposition, unfortunately that's not answer to my needs.
In my example, Human Resources doesn't have children item.
I have:
- A menu called Application, displayed in the left sidebar as a block
- zero or more menu items (depend of one value caught from LDAP)
These items are display like this :
And I cannot go to the administration page to define the parent item of Human Resources, because these items are displayed in function of a value caught from LDAP. So, for one user, there could be just one item, and for an other user there could be ten items.
I hope this is more clear.
Cheers,
Damien
----------------
Keep Open Spirit
- Damien
:: Keep Open Spirit ::
Create a designated parent
Create a designated parent item in hook_menu for the items that depend on LDAP. Move that item to the Application menu and deactivate it.
--
~/.singatrue: file not found
That's works
Thanks Traxer, that's works fine now.
- Damien
:: Keep Open Spirit ::
Defining parent item in hook_menu_link_alter
No need to use hook_menu_link_alter
The same approach can be used directly in hook_menu: