Implement hook_form_FORM_ID_alter(), rather than hook_form_alter()
phoehne - March 17, 2009 - 16:54
| Project: | Zeitgeist |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | minor |
| Assigned: | fgm |
| Status: | won't fix |
Jump to:
Description
the function
zeitgeist_form_alter
should be renamed to
zeitgeist_form_search_form_alter
so its only called when this specific form is used.
with the actual version the hook is matches on every form on your site.
gruss peter

#1
Confirmed
#2
To rename
zeitgeist_form_alter()is not enough, aszeitgeist_form_search_form_alter()would also require parameters that are different from the original function used.Then, to use
hook_form_alter()is not even a bug; it's simply code that has not been adapted to the new hooks made available from Drupal 6, but the old hook is still available, nor it has been reported as deprecated from the Drupal documentation.#3
I'm inclined to set "won't fix" because there is no obvious interest in having the two alters done in separate functions especially after today's changes.
Any other opinion (look at version 1.9.6.5 of zeitgeist.module) ?
#4
It doesn't make any substantial differences, to keep the code as it is now.
I would say that to use one hook or the other is a question of coding preferences; maybe it would make a difference if the module would execute a long chain of IFs to differentiate the executed code basing on the form ID.
#5
OK, then.