By olemsa on
How do I arrange the order of the function calls from custom modules to different hooks.
I want mymodule_form_alter to be called after secondmodule_form_alter
How do I arrange the order of the function calls from custom modules to different hooks.
I want mymodule_form_alter to be called after secondmodule_form_alter
Comments
The order in which hooks are
The order in which hooks are called is determined by 1. the module's weight in the system table and 2. alphabetically I think, if modules have the same weight.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
And how to manipulate the
And how to manipulate the weights of the module ? well, you can directly type some sql into the mysql terminal or simply use the Util(http://drupal.org/project/util) modules, Module Weight feature to see and manipulate the module weights on the module installation page :)
Cheers
If you are creating both
If you are creating both alter functions (ie. creating both modules), then you can use
hook_form_FORM_ID_alter()andhook_form_alter().hook_form_FORM_ID_alter()is run before hook_form_alter(), so they will be called in the order you want.Contact me to contract me for D7 -> D10/11 migrations.
I think the easiest way is to
I think the easiest way is to alter the column 'weight' of the 'system' table. The description of the column is quite clear :
This could be done by simple request :
Or as said you can use the UTIL module.
For Drupal 7
I know this is old and the answer requires Drupal 7, but for the sake of completeness, here it is.
I found this on http://drupal.stackexchange.com/a/9720/13553.
--
Husain
http://husainad.com
Blog - Twitter - LinkedIn