[development] Code freeze reminder

David Strauss david at fourkitchens.com
Thu Jun 21 16:50:09 UTC 2007

Derek Wright wrote:
>>   5. The node render patch that Eaton started work on a while ago.  I
>> don't think that is been committed yet, but Eaton recently reminded me
>> about how important this is to further unify and clean-up the CCK and
>> core.
> Eaton and I spoke about this at length last week.  We decided the next
> step for both node rendering and killing the evil $node namespace bugs I
> was ranting about earlier is to convert $node from an object into a
> #FAPI-style array.  This is a huge undertaking, but will solve a *bunch*
> of issues and open up tons of new possibilities.  I've been so busy with
> update_status that I haven't had a chance to work on the initial patch
> for this.  If anyone else wants to get the ball rolling, that'd be great:
> http://drupal.org/node/148420

I think this would be a bad idea, too. $nodes should be ultra-clean
representations of data. I often digest several form widgets to a single
item in the $node and perform a corresponding expansion to allow the
user to edit the node again.

If any simplification is to be had, it would be working with node data
in five hooks:

* Load $node from DB
* Render $node
* Convert $node to FAPI
* Convert FAPI to $node
* Save $node to DB

The only way I'd go for a FAPI-based $node is if we have a really clean
system for modules creating custom controls:

$form['complex_option'] = array(
  '#type' => 'module_control_callback',

function module_control_callback(Contents of $form['complex_option']) {
  $form['yes_no'] = array(
    '#type' => 'checkbox',
    '#title' => 'Custom etching',
  $form['text'] = array(
    '#type' => 'textfield',
    '#title' => 'Custom etching text',
  // FAPI prefixes the items returned here to control the namespace
  return $form;

function module_control_callback_validate(Form state within namespace) {
  // Return an error if "Custom etching" is checked
  // but the text is empty

function module_control_callback_submit(Form state within namespace) {
  // Returns NULL if "Custom etching" is unchecked or the text
  // from "Custom etching text"
  return $value_from_control;

It'd basically be a recursive Form API, but it would allow easy control
reuse, validation, and digestion.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 186 bytes
Desc: OpenPGP digital signature
Url : http://lists.drupal.org/pipermail/development/attachments/20070621/e5145a6b/attachment-0001.pgp 

More information about the development mailing list