[drupal-devel] Rewriting use of forms in Drupal

Gerhard Killesreiter killesreiter at physik.uni-freiburg.de
Fri Jun 3 13:54:02 UTC 2005



On Fri, 3 Jun 2005, Dries Buytaert wrote:

> > 1) We can ensure that only the fields that are defined by our PHP code
> >    can be used.
> >
> >    Currently, you can add html to any Drupal generated HTML form
> > and the
> >    values will be processed and possibly be inserted into the
> > database.
> >    We can also check if the fields still are of the type that they
> >    should. I am not sure that you can gain anything by exchaning a
> >    textarea input to a radioselect, but the possibility annoys me.
>
> With the exception of the node, comment (?) and user forms, no forms
> behave like that.

Well, those forms are quite important. :)

> What other forms behave like this?

Even if the answer (which I don't know) is "none" I'd still like to fix
the other forms.

> > 2) Themes could change the order and placement of fields. You could
> >    decide to generate your taxonomy tree somewhere else than between
> >    title and body. Maybe you can already do this through CSS, don't
> > know.
>
> If that is the case, we need to approach it from a themer's
> perspective and figure out _how_ he want to shuffle form items
> around.  Then we can worry about the implementation details.

Since I am not a themer I've taken the only approach I am capable of.
Chris had made some mockups a while ago. I guess we could ask ourselves
if we can make them happen with my approach and then decide if it is the
direction we want to go.

My approach has the advantage that themers do not even need to agree on
what the best order or layout of form elements would be as they could
modify anything that Drupal sends them in the theme. Of course, it is
desirable to have a default that is good and usually does not need
modifications. We should however allow themers as much flexibility as we
can. For example, the best place of some form element could depend on
the writing direction of the language used. We would want to allow
themers to accomodate this.

> > 3) People seem to like arrays more than strings. ;)
>
> That's not an argument.

Well, I think it is. As Karoly has pointed out it is quite difficult to
remember the right order of the numerous arguments of the various form
functions. I always have to look it up. Using an array would make this a
non-issue. Making coding for Drupal even easier is certainly an
argument.

Cheers,
	Gerhard




More information about the drupal-devel mailing list