Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
documentation
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
21 Oct 2010 at 11:21 UTC
Updated:
3 Jan 2014 at 02:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jhodgdonThat type of information belongs in either (a) the Examples for Developers project, or (b) a Handbook page. Not in hook_node_info().
And I'm actually reasonably certain it already exists in http://drupal.org/project/examples already. Please check out the examples there, and open an issue on that project if you think one of the examples needs more detail, more information, etc.
Comment #2
peterx commentedhook_node_info has a Related topics section that I thought would lead somewhere useful. Node API Hooks leads to node creation information, not node type creation. Hooks leads to a long trail of disconnected examples and those examples no longer use hook_node_info. A link to a node type creation tutorial page using hook_node_info would be useful.
http://drupal.org/project/examples points to node_example, the same example I reach from the Related topics link. node_example no longer uses hook_node_info. There are several posts saying hook_node_info is dropped in Drupal 7. The Book module no longer uses hook_node_info.
http://drupal.org/node/642862 mentions the problem. node_example shows node type creation using node_type_save instructions in hook_install() and hook_node_type_insert() to add fields.
Perhaps the documentation should suggest the new way of doing things and direct people to whatever replaces hook_node_info.
Comment #3
jhodgdonhook_node_info has not been dropped in Drupal 7. The core Blog and Poll modules both use it, for one thing. The Node API Hooks page does mention hook_node_info() at the top, and it is still the accepted way for a module to define a node type.
I'm sorry that the node example module has been changed so that it no longer uses hook_node_info(). I wasn't part of that decision, and it is unfortunate in my opinion. I wasn't aware of that until just now. The core Blog and Poll modules still provide examples of how to use it. The node example module has moved to a different model, where they're providing a node type that uses the field API, so it can be modified in the user interface. Anyway, use Blog and Poll modules in Core as examples.
So we shouldn't reference the node example module in the documentation block for hook_node_info any more, so that is a documentation bug that should be fixed. We just need to remove the line that says
For a detailed usage example, see node_example.module.
That's a good project for a novice contributor...
Comment #4
amateescu commentedHere it is.
Comment #5
jhodgdonThat's it, thanks!
Comment #6
webchickCommitted #4 to HEAD. Thanks!