In drupal_prepare_form() - hook_form_$form-id_alter() execution is separate and prior to hook_drupal_alter() execution, resulting with a module's weight being insignificant in the following scenario:
A module implements hook_form_alter() and module weight = 0;
B module implements hook_form_$form-id_alter() and module weight=30; However it will be executed before A module.
This limits the power of hook_form_$form-id_alter() in tidying the code.
Comments
Comment #1
moshe weitzman commentedThe same can be said if we switch these around. Someone always gets to go last - thats the premium position in drupal. This is a timeless problem and we are actually on the verge of solving it since we have hook implementations in the registry now and can add a weight to each one.
Comment #2
moshe weitzman commentedWell, we could swap the order if people want.
Comment #3
amitaibuAlso from conversation in IRC with chx and webchick I understand that updating the docs might be good enough - #331832: Document hook_form_FORM_ID_alter().