I am a newbie into Drupal.
what else other than module name can replace 'hook' from any hook function in Drupal?
For ex.
"myModule" replaces hook in hook_form_alter and defined as 'myModule_form_alter'
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI am a newbie into Drupal.
what else other than module name can replace 'hook' from any hook function in Drupal?
For ex.
"myModule" replaces hook in hook_form_alter and defined as 'myModule_form_alter'
If you are particularly looking at theme hooks following from https://www.packtpub.com/books/content/drupal-7-module-development-drupals-theme-layer can be useful.
All preprocess functions run before all process functions template_ prefixed functions run frst. [module]_ prefixed functions run next. [theme]_ prefixed functions run last Multi-hook functions run before hook-specific functions This results in the following order of execution for a particular theme hook:
template_preprocess()
template_preprocesss_HOOK()
MODULE_preprocess()
THEME_preprocess()
THEME_preprocess_HOOK()
template_process()
template_processs_HOOK()
MODULE_process()
MODULE_process_HOOK()
THEME_process()
THEME_process_HOOK()
Any alter hook and preprocess hooks that is defined inside a module can also be defined inside the theme as well. So if you are using Bartik theme you can open the Bartik's template.php file and use
function bartik_form_alter(){}
UPDATE
Checking the Is it possible to define hook functions in template.php instead of the module? can also be helpful.