Between them the hooks documentation pages and the node_example.module pages (http://api.drupal.org/api/file/developer/examples/node_example.module/5) are unclear about how to create a new content type in a custom module.

The node_example.module has too many hooks and is too rich an example. It should be clear what the bare minimum is, aside from any fancy fields. (It appear the minimum is hook_node_info() and hook_form.)
Meanwhile, the page for hook_node_info should say what other hooks need to be implemented.

Comments

aj045’s picture

I thought the example provided here: http://drupal.org/node/132845 showed the minimum? Admittedly that example is a bit long and clunky. May need updating but I always fall back to that page if I need a refresher on custom node creation.

joachim’s picture

As I make it, you can lose:
# hook_perm()
# hook_access()

It does go on a bit... :)
The stuff on making an info file could be cut, for instance.

Maybe the example on API could point to this handbook page?

aj045’s picture

Updating the API would be a patch, I would imagine.

betz’s picture

Project: Documentation » Drupal core
Version: » 7.x-dev
Component: Documentation in CVS » documentation

Changed the component to reflect the new component categorization. See http://drupal.org/node/301443

Bojhan’s picture

Seems somewhat wierd to still mark this as a bug of Drupal 7, now that fields have gone in

joachim’s picture

There are still modules that define node types in code.

jhodgdon’s picture

Project: Drupal core » Examples for Developers
Version: 7.x-dev »
Component: documentation » Miscellaneous

Example modules are now in a different project, so I'm moving this issue to that queue, for further discussion.

rfay’s picture

Status: Active » Fixed

I'm going to mark this fixed. The new #508342: D7 Node example demonstrating fields node example module is updated for D7.

Reopen if you like.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.