Imagine I have module with multiple forms with dynamical ids built by one builder function using hook_forms(). It is obvious that my module requires to submit all those forms to single one "..._submit" function. Right now Drupal searches for _submit for every form id, so I have to set $form['#submit'] explicitly in my form builder function, it tooks some time to investigate it from forms.inc. Isn't it would be better to assume submit function name by callback name provided by hook_forms()?

CommentFileSizeAuthor
dynamic_form_ids_patch.txt1.05 KBsin

Comments

sin’s picture

Status: Active » Needs review
webchick’s picture

Version: x.y.z » 6.x-dev
Status: Needs review » Closed (won't fix)

In 6.x, the form API was simplified to make it more consistent, and one of these simplifications was removing the #base property in favour of always specifying explicit callbacks. From the FAPI maintainer:

chx: if there would be a #base then this patch would be a very good idea, set #base automatically for hook_forms -- but #base is gone.

Therefore, I'm setting this to "won't fix" ... sorry. :\

sin’s picture

:)

Changing API's to make them better is a thing I like Drupal for. Thanks for your comment, webchick.

I remember I have troubles finding code examples of how to specify callbacks explicitly, so please, provide some in http://api.drupal.org/api/HEAD/file/developer/topics/forms_api.html