Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This patch creates 2 separate functions, removes the form_alter and and moves functionality to these 2 new functions.
Comment | File | Size | Author |
---|---|---|---|
move_hook_form_alter_to_hook_form_form_id_alter-0.patch | 1.86 KB | Rob C | |
Comments
Comment #1
SpleshkaHi,
What is the reason of this changes?
Comment #2
Rob C CreditAttribution: Rob C commentedI like to have as little as possible statements, and the exact same thing is possible via hooks, no if then else required. (and it looks a bit cleaner, especially when you want to expand the module at some point).
I try to use hook_form_alter() only when i really need to, for the node edit form and such, i put all others in their respected hook_form_FORM_ID_alter() functions. (except when it's not possible obviously).
Comment #3
SpleshkaSo if this change is not breaks any module logic, I suppose this issue could be closed.