Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
documentation
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
5 Mar 2011 at 22:58 UTC
Updated:
3 Jan 2014 at 02:58 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jhodgdonYou identified two problems here:
a) example reference - You are correct, the node example module for D7 does not include hook_form any more, so that reference should be removed from the documentation.\
b) name of this hook - On this you are incorrect. hook_form() is one hook, and hook_node_form() is a separate hook. See http://api.drupal.org/api/drupal/modules--node--node.pages.inc/function/... to see where hook_form() is invoked, and http://api.drupal.org/api/drupal/modules--node--node.api.php/group/node_... for a complete list of node hooks. I don't think there is a hook_node_form() in D7. I think the doc on the hook_form() page is correct.
So we do need to fix (a).
Comment #2
francort commentedThank you for the information!
When I've implemented node_example_form() , nothing has happened. But when I've implemented node_example_node_form() the form defined on the function took control over the node_example form.
The description on the documentation is more similar to what happened with node_example_node_form thus I though It could be an error on the hook name.
Comment #3
jhodgdonI don't know what to tell you. Obviously, it needs some investigation...
Comment #4
barrett commentedComment #5
barrett commentedattaching the patch this time...
Comment #6
jhodgdonBarrett: I think we need a bit of investigation into the above questions - is this really supposed to be hook_form or hook_node_form, and if both exist, why isn't hook_node_form documented anywhere and what does it do?
Comment #7
drewish commentedThe hook is hook_node_form() so if the name module is example_node then the implementation would be named example_node_node_form().
Update: Actually that's not correct, I was thinking this was a D6 issue and even there it's more complicated.
Comment #8
jhodgdondrewish: I think the hook is hook_form() in d7. See #1 above. If the hook really is called hook_node_form() then we have a lot of reworking of doc to do...
Comment #9
damien tournoud commentedThere is no such thing as hook_node(). What we have is a *callback* (or "pseudo-hook"), named
[node type base]_form().Comment #10
jhodgdonSure. But we call it hook_form(), just like we call all the other pseudo-hooks hook_whatever().
Comment #11
damien tournoud commentedI know we do, but we should not.
Comment #12
jhodgdonI agree, but we can't really change it now for d6/7. Let's bring that up as a separate issue for D8 coding/doc standards.
Comment #13
barrett commentedI'm unassigning myself since I'm not sure what the correct solution is for this issue.
Comment #14
jhodgdonI think we should just commit the patch in #5.
Comment #15
jhodgdonNeeds to go to d8 and then d7
Comment #16
dries commentedCommitted to 8.x.
Comment #17
webchickCommitted to 7.x. Thanks!