[development] FAPI's future

Jeff Eaton jeff at viapositiva.net
Wed Aug 8 21:43:35 UTC 2007


On Aug 8, 2007, at 4:06 PM, Peter Wolanin wrote:

> or simpler still require (or at least allow) $form['#title'] for each
> form?  Or some similar top-level property?
>
> -Peter

This gets nasty very quickly. Retrieving one form, whose ID you know,  
and displaying its human-readable title, is fine. But figuring out  
whether there is another form, somewhere on your site, that you want  
to perform the same operation on? That's nasty.

It's similar to the problem that we faced with theme functions in  
Drupal 5: overriding a theme function was easy ... once you figured  
out it was there. But figuring out *what theme functions existed for  
overriding* was an exercise in using regexes. In the D6 theme system,  
we solved this by creating a theme function registry. If you don't  
announce your 'foo' theme function in hook_theme(), you can't call  
theme('foo'). That makes the cached theme registry a reliable place  
to obtain information about theme functions.

FormAPI, if it's to be used in the way that Dries seems to be talking  
about, needs this sort of system. otherwise, we're stuck with 'cool  
hacks,' like modules that hook_form_alter() everything while you  
browse around the site, and save a list of all the Form IDs they see  
pass by. That's way less than ideal.

--Jeff


More information about the development mailing list