As pointed out by Justin Ellison on the Development email list...
In Drupal 6, drupal_prepare_form() definitely [look at bottom of function] invokes hook_form_FORM_ID_alter() before hook_form_alter(), but the hook documentation states the opposite.
In Drupal 7, drupal_prepare_form() apparently calls the generic hook_form_alter() first, then hook_form_BASE_FORM_ID_alter, then hook_form_FORM_ID_alter(). The doc is correct in D7.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | docs_1031458.patch | 1.42 KB | drewish |
Comments
Comment #1
drewish commentedI'll take a swing at this.
Comment #2
drewish commentedHow's this look?
Comment #3
jhodgdonI'm not sure I like the bit about "most modules use hook_form_alter()". Actually, at least in D7 I think the opposite is true. And I prefer hook_form_FORM_ID_alter() because it is (a) self-documenting which form you are altering in the function name and (b) you don't have to do a big switch on the form ID because it is already specific.
I guess I'll have to figure out this git stuff so I can commit this eventually. :)
Comment #5
jhodgdonThis is a duplicate of a new and more current issue:
#1229868: hook_form_BASE_FORM_ID_alter(), hook_form_alter(), and hook_form_FORM_ID_alter() doc inconsistent.