[development] changes to hook_nodeapi

Jeff Eaton jeff at viapositiva.net
Thu Aug 31 15:46:18 UTC 2006


I haven't had a chance to look at the details of the nodeapi patch in
question, but I will say that programmatic submission of data using
forms just got a bit simpler, as http://drupal.org/node/80470 was
committed. It adds a 'drupal_execute()' function that processes forms
without any of the rendering/ui cruft.
 
changing a node, for example, would involve the following:
 
$node - node_load(1);
$values['title'] = 'My new title!';
drupal_execute($node->type . '_node_form', $values, $node);
 
It's different, yes. But the advantage is that you will get all of the
validation logic, all of the modifications made by form_alter code (like
taxonomy_defaults), and so on, for free.
 
I can't offer any insight into the actual nodeapi changes, but hopefully
the above snippet helps assuage some fears about programmatic content
changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20060831/a0e0306b/attachment.htm


More information about the development mailing list