[development] hook_nodeapi()

Scott McLewin drupal at mclewin.com
Tue Jan 2 16:24:36 UTC 2007


I too had trouble with this concept when I first started working with 
Drupal.  The most simplistic description I can give of the difference is 
that hook_insert()/hook_update() and friends are for use in a module 
that defines a node type.  hook_nodeapi() is for use in modules that 
augment or extend node types defined by other modules.

By example, the page module defines a node of type 'page'.  The event 
module augments any node type, including page, to add date information 
to the node.


Fernando Silva wrote:
> Hi,
> In the following page
> http://api.drupal.org/api/HEAD/function/hook_nodeapi it says: "If you
> are writing a node module, do not use this hook to perform actions on
> your type of node alone. Instead, use the hooks set aside for node
> modules, such as hook_insert() and hook_form()."
> My question is why is it better to use the standalone functions
> instead of the centralized one?
> Regards,
>  Fernando Silva

More information about the development mailing list