[development] Forms API II: Return of the Chx (you really need to read this)

Chris Johnson chris at tinpixel.com
Fri Aug 18 22:14:27 UTC 2006


Jeff Eaton wrote:
> Greetings, folks! There's been talk for the past week or so about the 
> 'pull model' patch for Forms API that chx rolled. It's been committed 
> after some furious rounds of polishing, and it removes many barriers for 
> advanced use of the Forms API. It DOES, however, require some 
> conversion/updates to existing functions that generate and display 
> forms. Here's the quick and easy guide to the changes.
>

>  
> And that, dear friends, is about it. To recap:
>  
> 1) drupal_get_form() now takes a $form_id, NOT a $form_id and a $form.
> 2) You need a builder function with the name of the $form_id that 
> returns the fully constructed $form array
> 3) If your page content is JUST a form, you can use drupal_get_form as 
> your menu callback, with $form_id as your menu callback argument.
> 4) If you need to use the same $form for multiple $form_ids, use 
> hook_forms()
> 5) If you want the submit, validate, and theme functions to use naming 
> different than the $form_id, set $form['#base']
> 6) Use drupal_retrieve_form(), $form['#post']['edit'], and 
> drupal_process_form() to programmatically submit forms.
>

This, of course, needs to put into the module developers documentation pages. 
  Is someone doing that?



More information about the development mailing list