[development] The future of hook_node_info()

Arancaytar Ilyaran arancaytar.ilyaran at gmail.com
Thu May 21 12:54:03 UTC 2009

Hey all,

This is just a bit of idle speculation (and it may even have been
discussed before) but I wanted to share my observation. There may be a
changing trend in how Drupal perceives node types.

Way back, a node type was handled by exactly one module. Most
type-specific functionality could only be applied to the native type.
For example, CCK defined "cck-clones" of all existing content types in
4.7. You need to go back as far as 4.0 (see changelog) to see
book.module adding support for non-book nodes, but that's still where we
came from.

Even in Drupal 4.7 we had story.module and page.module providing what
have since become custom content types created by the installation profile.

Between Drupal 4.7 and Drupal 5, a lot of these type-specific features
became universal. CCK stopped implementing hook_node_info and expanded
hook_nodeapi (which had only watched the 'delete revision' action
before). story.module and page.module got axed.

In Drupal 6, book.module stopped implementing hook_node_info() too, in
favor of creating a type handled by node.module, and treating all node
types the same way.

Altogether, we're down to three hook_node_info implementations in Drupal
7 (from six in Drupal 4.7), which are blog.module, forum.module and
poll.module. Coincidentally, these modules are all somewhat notorious:
forum.module's has a very frustrating visual style, poll.module has been
called our "regression test", and both poll.module and blog.module have
been considered for removal (Google "remove X from core"). Only
poll.module can still make a convincing case for using hook_node_info,
but even poll stuff could in theory be added to generic nodes.

Will hook_node_info() eventually die entirely, in favor of working on
nodes centrally handled by node.module? Should it?

Thanks for reading all the way, :)


PGP:   http://ermarian.net/downloads/0x27CA5C74
XMPP:  arancaytar.ilyaran at gmail.com
AOL:   282026638 @icq / RealArancaytar @aim
URL:   http://ermarian.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.drupal.org/pipermail/development/attachments/20090521/ad5fb400/attachment.pgp>

More information about the development mailing list