Closed (fixed)
Project:
Documentation
Component:
API documentation files
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Aug 2010 at 01:29 UTC
Updated:
20 Dec 2011 at 20:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
jhodgdonActually, it looks like we have problems with the hook_form() documentation in both D6 and D7.
There's a comment on the D7 page that probably needs to be incorporated into the text of the description http://api.drupal.org/api/function/hook_form/7#comment-2813 -- well I'm not sure it belongs on hook_form(). Probably the comment should be removed.
Also, in D7 it says the return value should include the title and body, but the example doesn't -- one of them must be wrong... let's see. Looking at blog_form and forum_form, it looks like you do need to include the title, so the example is wrong in D7. But since body is a Field API Field now in D7, you don't include that, so the text is wrong about that. The text should probably say something about not including any fields (such as body) because the field UI module will put them on.
In D6, it looks like the text is correct, but I agree that the example function body should use node_body_field().
Anyway, let's fix it in D7 first...
Comment #2
jhodgdonHere's a proposed patch for D7.
If accepted, this needs to be moved down to D6.
Comment #3
avpadernoIt looks perfect.
Comment #4
dries commentedMinor comment:
We should probably write [node type] instead of [nodetype] when we write [node ID] and not [nodeid].
Comment #5
avpadernoThat is true.
Comment #6
jhodgdonCan someone else re-patch? I'm on an extended cycling holiday, currently riding along the Danube river, and just occasionally checking the issue queue and/or email. I'll be back in October...
Comment #7
ctmattice1 commentedre-rolled per dries comment
Comment #8
jhodgdonLooks good, thanks!
Comment #9
jhodgdon#7: 883454_1.diff queued for re-testing.
Comment #10
dries commentedCommitted to CVS HEAD. Thanks.
Comment #11
avpadernoThe patch needs to be ported to Drupal 6. The documentation for Drupal 6 needs to be changed differently from the documentation for Drupal 7 (see comment #1).
Comment #12
jhodgdonMoving to docs queue (where the file is for d6 for hooks)
Comment #13
sven.lauer commentedRe-rolling for D6, only changing the example code to use node_body_field() (and adding missing #default_value to the title field).
Comment #14
jhodgdonLooks good. Committed and pushed.
Comment #15
jhodgdon