[drupal-devel] Rewriting use of forms in Drupal

David Carrington david.carrington at gmail.com
Fri Jun 3 09:42:46 UTC 2005


On 03/06/05, Gerhard Killesreiter <killesreiter at physik.uni-freiburg.de> wrote:
> Instead of
> 
> $output .= form_textfield(t('Title'), 'title', $edit->title, 60, 128, NULL, NULL, TRUE);
> 
> we'd write
> 
> $output['title'] = array('type' => 'textfield',
>                          'title' => t('Title'),
>                          [...]
>                         );

The biggest problem I've come across with this method is that it
provides incredibly little flexibility in the form layout. You're
almost completedly restricting yourself to a plain old linear form,
with no side-by-side controls or anything else.

For example, my recipe module has a table in it. Each row of that
table has 3 input fields in it. I dread to think what the code looks
like to generate that with an array of controls.

--
David Carrington



More information about the drupal-devel mailing list