Closed (cannot reproduce)
Project:
Examples for Developers
Version:
7.x-1.x-dev
Component:
Node Example
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
8 Feb 2011 at 09:17 UTC
Updated:
26 May 2011 at 20:51 UTC
Jump to comment: Most recent
Comments
Comment #1
ilo commentedSorry, do you mean hook_node_info() ?
If this is the case then there is a little literature about it:
#942830: Missing hook_node_info() in node_example.module
#902740: Dont use hook_node_info
Not sure what is the expected behavior here.. perhaps we should fill a core bug?
Comment #2
cliffp commentedHi ilo, yes I did mean hook_node-info(). I located a D6 issue which describes the problem (or a problem with similar symptoms) : http://drupal.org/node/960922. He found the solution at http://drupal.org/node/982270, where he was advised to move his hook_node_info from his .install to his .module. I created a hook_node_info implementation and my new 'content type' stayed in node/add after a cache clear.
The interesting thing is that node_example doesn't have a hook_node_info implementation and yet the node_example content type stays in node/add after a cache clear, and I thought that my module was pretty much a clone of node_example. It was a clone to begin with.
I looked at the references but I don't really understand them and they seem to refer to other stuff. I'll need to digest http://drupal.org/node/755640 which is where all the action seems to be.
Cheers,
Cliff
Comment #3
cliffp commentedBTW, as I'm new to this, how do you create the pink and blue links above?
Comment #4
rfay@cliffp, there is a filter that parses issues. You use text like this:
#942830: Missing hook_node_info() in node_example.modulebecomes #942830: Missing hook_node_info() in node_example.moduleYou can point to a particular comment in an issue with
#902740-3: Dont use hook_node_infoLike this: #902740-3: Dont use hook_node_infoThe colors indicate the state the issue is in. You can also float over to see what the color means.
Comment #5
mile23@cliffp, hook_node_info() is a way for your module to define a node in the old-school NodeAPI system. You can see it in action in the Drupal 6 node_example.module.
In Drupal 7, you do basically the same thing but using node_type_save() and 'base' => 'node_content' in hook_install(), which you can see in node_example.install. Drupal 7 also supports the NodeApI system (upgraded in a few ways), but node_type_save() is the new best practice.
Comment #6
cliffp commentedSOLVED ----
I'm still not quite sure what is going on, but Mile23 solved it for me! Mile23, I know that hook_node_info is the D6 way of doing it, and that is why I have pursued the issue. I already used node_type_save(), but what I had wrong was that I had set 'base' to 'mymodule' and not 'node_content'.
At last I can move on!
Thank you, thank you, thank you!
Cliff
Comment #7
cliffp commented@rfay,
Thanks for the info,
Cliff
Comment #8
rfayGlad it all worked out!
Comment #9
mile23Here it is, clear as mud: http://drupal.org/node/224333#node_type_base Note that this is for hook_node_info() which is is apparently completely vestigial at this point. I thought I made a patch that documents some of this, but I can't find it. I'll wait until someone has rolled a few more commits and patch it.
Glad it worked for you, Cliff. :-)
Comment #10
cliffp commentedAnd it is also found as a comment in this article, in the API documentation.
http://api.drupal.org/api/drupal/modules--node--node.module/function/nod...
Of course, Murphy only let me find that after the problem had been solved for me by Mile23!
Comment #11
tr commentedReopening and setting version.
Comment #12
Anonymous (not verified) commentedI'm doing a screencast that demos how to work in the issue queue, so I'm going to assign this to myself to use as an example. Mile23, feel free to take over again after tomorrow.
Comment #13
Anonymous (not verified) commentedI don't think that this hook is used in the node_example module anymore. I'm going to close this.
Comment #14
mile23I should never have assigned it to myself. :-)
I was waiting for the big doxygen patch to happen.