[development] programmatic creation of node
mistknight at gmail.com
Fri Jul 11 15:54:52 UTC 2008
Quoting Moshe Weitzman <weitzman at tejasa.com>
> In drupal5, you should call hook_node_submit() and
> hook_nodeapi('submit') before node_save(). that will assure that any
> group info gets saved (for example).
> In d6 this is not needed since those submit hooks became
> hook_nodeapi(pre_save) and that happens from within node_save().
> drupal_execute is also a valid way. the node_load() is a little
> expensive but this is a very clean way to proceed. if it is working
> for you, i would proceed like this.
The documentation to convert hook_submit to drupal 6 says to add
$form['#submit'], not to create a nodeapi(presave). I'm a bit confused here.
Should I convert my hook_submits to nodeapi(presave) or should I simple add
$form['#submit'] to the form?
I believe if I change it to nodeapi(presave) then I won't need to call
hook_node_submit() before calling node_save() as this would be taken care by
the presave call in node_save(). But it seems that even in drupal 6, if I
use $form['#submit'] I'll still have to do a call to the hook_node_submit()
before calling node_save().
Am I missing something here?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the development