#base has always been the bane of our existence. It allowed us, in the small number of cases where many forms with different IDs all used the same theming, submission, and validation handlers, to map using a base name like my_form rather than the full id, like my_special_form.

This patch eliminates #base entirely, in favor of explicitly setting the #submit, #validate, and #theme handlers. It also simplifies form.inc a bit, and -- this is a biggie -- paves the way for some cleaner solutions to things like 'give each form button its own private callback'.

We want this. It is a happy thing.

Caveats: some of the forms probably don't need the #theme function set, but setting it means that any theme overrides of them won't break.

CommentFileSizeAuthor
no_more_base.patch13.97 KBeaton
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webchick’s picture

I love form API! Subscribing so I can test this later!

pwolanin’s picture

Subscribing..

Does your comment above mean that #theme always needs to be set, or only when #submit != $form_id .'_submit'?

eaton’s picture

Yes, this is *only* necessary if you're mapping things to functions *other* than $form_id + _submit _validate, etc.

Normal standard forms, with one ID and one builder function, are unchanged.

chx’s picture

Status: Needs review » Reviewed & tested by the community

I think the balance between automatisms that need to be learned and simplicity in this case tilts towards this patch. #base is rare enough (look the whole patch is only 14K). Well done.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

webchick’s picture

Status: Fixed » Active

Needs to be documented http://drupal.org/node/114774

eaton’s picture

Thanks, Dries! Docs at http://drupal.org/node/114774 have been updated.

eaton’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)