On 8/8/07, Jeff Eaton <jeff@viapositiva.net> wrote:
On Aug 8, 2007, at 5:47 AM, Dries Buytaert wrote:
For this work, each form needs (i) a human-readable name that can be shown on a configuration page and (ii) all submit buttons require some semantic meta data as well. Right now, 'Submit' can be both 'create' or 'update'.
This is a good case for hook_forms() being a requirement, not an optional mechanism. Right now, users can just call drupal_get_form ('lovely_delicious_bacon') and FAPI will go about its business happily, checking for a lovely_delicious_bacon() function, then checkig hook_forms() to see if lovely_delicious_bacon was really mapped to my_module_bacon_form().
If we were to make even the simple forms require the use of hook_forms (), we would have a very simple transition and an easy place to put descriptive metadata. ("What kind of form is this? What module does it belong to?" Etc.)
This would add another step to building forms and fragment the form code. Keeping a form's code all in one place is good and makes forms easier to code. Another possibility is using consistent function names for forms. This is how I removed the index of update functions that used to exist in update.php, I required the update function names to follow a pattern and finding all of them was done easily. -- Neil Drumm http://delocalizedham.com