Enable dependent modules automatically via the hook_enable of the parent module

surferisback - January 21, 2009 - 16:22
Project:Enabled modules
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:surferisback
Status:active
Description

I have a parent module with several sub-modules. When I enable the parent module, I would like to enable automatically the children.
For each module I would like to update my primary and secondary links menu with a menu link item of the parent module in a first level menu and the menu link items of children module in a second level menu.

example:

  • parent menu item
    • child1 menu item
    • child2 menu item
    • child3 menu item
    • ...

I manage to create the menu_item_link for the parent module with the menu_link_save function. But I don't manage to retrieve the mlid of the parent module to create the second level menu item of the children.

I tried to use the module_enable function in the hook_enable of the parent module to automatically enable the children module and to create the menu link but nothing happened.

I don't know if we can resolved my problem with the module and menu functions of the drupal API.

I hope that someone can help me.

Cheers

 
 

Drupal is a registered trademark of Dries Buytaert.