[development] Overriding function declared in another module

Leonard den Ottolander.nl drupal at den.ottolander.nl
Tue Jan 18 12:22:11 UTC 2011


Hi,

I'm trying to modify the delegate_menu_admin module in such a way that
the node/add/page form will show the Menu Settings for users with
"administer some menus" permissions. In it's current form the module
will allow users with this permission to add pages via node/add/page and
subsequently link them to menu items via admin/build/menu without having
full "administer menu" access. However, this two step approach is not
very convenient.

The problem I face is the fact that menu_alter_form() declared in
menu.module (Drupal 6.2) unconditionally overwrites
$form['menu']['#access'] with "user_access('administer menu')" where I
want it to also honour user_access('administer some menus'). I also want
to limit the presented menus in "Parent item" to the ones that the user
has access to but that's just a matter of filtering out the forbidden
menus.

I would like to avoid having to hack the menu module itself, so I am
looking for a way to unhook and redefine menu_form_alter() in
delegate_menu_admin. I don't want the module to have to rely on things
like PECL modules (override_function() from APD is way too intrusive).
Depending on other Drupal modules is an option but I'd rather avoid that
too.

So the question is, how do I override menu_form_alter() from another
module?

Regards,
Leonard.

-- 
mount -t life -o ro /dev/dna /genetic/research




More information about the development mailing list