[development] hook_nodeapi()

Jeremy Epstein jazepstein at gmail.com
Tue Jan 2 22:34:31 UTC 2007


In Drupal 5.0, the difference between hook_insert() / hook_update()
and friends, and hook_nodeapi(), is smaller than ever; and there is
less need than ever to actually still have the former in core. With
the new CCK-partially-in-core features, it's likely that before long,
there will be no such thing as module-defined node types. There will
only be user-defined node types.

All four of the module-defined node types that are still in 5.0 core
(blog, book, forum, and poll) can and should be made history, and in
their place we can just have hook_nodeapi() implementations, that
allow the same functionality to be available to custom node types
(there's also a push to make poll a CCK field type, rather than a
node-type-ish thing).

To, in summary: your confusion is understandable! And, since we're
pushing for more widespread use of custom content types, I would
advise trying to use only hook_nodeapi() in your contrib modules from
now on, unless you have a use case where module-defined node types are
really appropriate (and such use cases are rare).

Cheers,
Jaza.

On 1/3/07, Fernando Silva <fsilva.pt at gmail.com> 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