[development] Cleaner and more consistent code.

Jeff Eaton jeff at viapositiva.net
Fri Aug 3 12:28:41 UTC 2007


On Aug 3, 2007, at 7:10 AM, adrian rossouw wrote:

> $form = new form();
> $form['title'] = new element(array(  // this would probably be new  
> DrupalTextfield() or something
> 	'type' => 'textfield',
> 	'title' => 'my title',
> 	'default_value' => 'default text'
> ));
> $form['group'] = new element(array(
> 	'type' => 'fieldset',
> 	'title' => 'meh')
> );
>
>
> $form['group']['moretext'] = new element(array(
> 	'type' => 'textfield',
> 	'title' => 'blah'
> ));
>
> print $form['group']->type;
> print $form['title']->default_value;
>

You just made me the happiest boy in the world.

Honestly, this straightforward nesting syntax is the only reason that  
I've felt we should steer away from objects in D6. the use of # to  
mean 'property' took a log of explaining. Getting rid of that, while  
maintaining the clean nesting syntax, would be a huge huge win.


More information about the development mailing list