On 03 Aug 2007, at 11:54 AM, David Strauss wrote:
I strongly support this move.
Khalid Baheyeldin wrote:
Karoly (chx) seems to be in favor of going all arrays and
getting rid of pseudo objects.
http://drupal4hu.com/node/52
He mentions others who support this too.
Drupal 7 is the time to do this, not D6.
I believe in this too, as it melds more with Drupal's structured array syntax, but PHP5 might
change my opinion.
Especially when you throw in things like the ArrayObject syntax (array / object duality), which could
even potentially supplant #-notation.
So yeah. needs more time to gestate methinks.
<?php
class form extends ArrayObject {
function __construct($props = null) {
foreach ((array) $props as $key => $value) {
$this->{$key} = $value;
}
}
}
class element extends ArrayObject {
function __construct($props = null) {
foreach ((array) $props as $key => $value) {
$this->{$key} = $value;
}
}
}
$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;
~