I have an entity, when i submit this entity i want to add the new entity created in a menu as a link. But in this menu i have a tree links so i don't know how to put my link in a specific tree. I saw the "mlid" and the "plid", i think "mlid" is the id of the menu and the "plid" is the id of the mother link.
So if I want to add a new item, what do I need to do? Do I get the ID of the parent link? Do I need to use menu_link_save()? How do I construct my new link?
This is the code I am using.
$menu_intervenant_loaded = menu_load_links('menu-intervenant-project'. $idProject); foreach ($menu_intervenant_loaded as $menu_item) { $menutitle = str_replace(" ","+", $menu_item['link_title']); $mlid = $menu_item['mlid']; $link = menu_link_load($mlid); $haschildren = $menu_item['has_children']; if ($menutitle == "Entreprises") { //The parent link: here is where I need to create my link. $item = array( 'title' => 'Montitre', 'access' => TRUE, 'link_path' => 'encore un test', 'link_title' => 'Mon titre qui fonctionne pas', 'plid' => $mlid, 'customized' => 1, 'external' => 1, ); menu_link_save($item); } } EDIT : With this code the link appear when i debug my menu before submit, but doesn't appear in my administration and front-end where the menu is placed..