[drupal-devel] Rewriting use of forms in Drupal

Gerhard Killesreiter killesreiter at physik.uni-freiburg.de
Fri Jun 3 11:09:18 UTC 2005

On Fri, 3 Jun 2005, David Carrington wrote:

> 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.

The intend of my proposal is to allow for this type of form layouts.

> 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.

I currently have no solution for this. As my proposal is now, you'd need
to tell your theme what to do with the individual fields. An idea is to
have form()  (which would become theme_form()) call a "form layout"
hook. Hmmmm.


More information about the drupal-devel mailing list