Posted by nicktr on March 13, 2013 at 4:50pm
Hi,
I've made a custom module to hold a number of custom functions - one being hook_menu_alter
All the examples I can find show the hook_menu_alter function name using the module name e.g.
- module name: customsitefucntions
function customsitefucntions_menu_alter(&$items) {
Does it have to follow this convention? What if I want to add another hook_menu_alter function in the same module?
Could it be:
function anotherFucntion_menu_alter(&$items) {
Thanks,
Nick

Comments
Ok so I tried removing the
Ok so I tried removing the module name of my hook_menu_alter and replacing it with another name, and it broke it.
So, I guess you would only ever use 1 hook_menu_alter in a particular module, as you can target any menu you want from there, so there wouldn't be a need for another!?
Unfortunately that's the
Unfortunately that's the case.
hook_menu_alter is a hook, which is automatically called at a certain state if system notice a hook function defined with specific naming convention, e.g. modulename_menu_alter for modules and theme_menu_alter for template.php (please correct me if I'm wrong :P).
However, your module can have functions that don't start with "modulename", though they will be considered as a custom function and they will only be executed if they are called in other hooks IIRC
function modulename_menu_alter() {
customfunc();
}
function customfunc () {
// do something
}
Kelvin Lee
Onion Creative
Twitter: @KelvinLeeHK | @OnionCreativeHK
Google+: +Kelvin Lee
I see, thanks for explaining,
I see,
thanks for explaining, Kelvin.
Nick