[development] hook_nodeapi()
Gerhard Killesreiter
gerhard at killesreiter.de
Wed Jan 3 17:03:19 UTC 2007
Fernando Silva wrote:
> 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.
I don't think that this is a valid conclusion. /If/ you create your own
node type and it has an extra table you should use the basic hooks.
Because then your node will already be fully populated once it gets into
nodeapi and other modules can act on the full node.
Cheers,
Gerhard
More information about the development
mailing list