[development] hook_nodeapi()

Fernando Silva fsilva.pt at gmail.com
Wed Jan 3 16:44:09 UTC 2007


node_load()
if ($extra = node_invoke($node, 'load')) {
foreach ($extra as $key => $value) {$node->$key = $value;}}
if ($extra = node_invoke_nodeapi($node, 'load')) {
foreach ($extra as $key => $value) {$node->$key = $value;}}

node_save()
node_invoke($node, 'insert');
node_invoke_nodeapi($node, 'insert');
node_invoke($node, 'update');
node_invoke_nodeapi($node, 'update');

node_delete()
node_invoke($node, 'delete');
node_invoke_nodeapi($node, 'delete');

The conclusion is that the "nodeapi" is the way to do things, and that
the other way was just keeped as unnecessary compatibility, and should
be quickly deprecated.

Also, I think that
http://api.drupal.org/api/HEAD/function/hook_nodeapi should be updated
to state that there is really no diference between those two APIs, and
that the later is much more complete than the former.

Thanks,
  Fernando Silva

On 1/3/07, Khalid B <kb at 2bits.com> wrote:
> I add my voice to Jaza. Unifying these two APIs in the future is a good
> thing.
>


More information about the development mailing list