[documentation] [Documentation bug] hook_validate documentation claims to use modifications to the passed $node parameter
pwolanin
drupal-docs at drupal.org
Sun Dec 17 17:10:04 UTC 2006
Issue status update for
http://drupal.org/node/101930
Post a follow up:
http://drupal.org/project/comments/add/101930
Project: Documentation
Version: <none>
Component: Misc
Category: bug reports
Priority: normal
Assigned to: Anonymous
Reported by: Wesley Tanaka
Updated by: pwolanin
-Status: patch (code needs review)
+Status: fixed
also commited the same changes to the 4.7 branch
pwolanin
Previous comments:
------------------------------------------------------------------------
Thu, 07 Dec 2006 14:08:15 +0000 : Wesley Tanaka
http://api.drupal.org/api/4.7/function/hook_validate says:
"
It can also be used to make changes to the node before submission, such
as node-type-specific formatting.
"
Both my recollection and an attempt to do that just now are contrary to
that claim.
------------------------------------------------------------------------
Thu, 07 Dec 2006 14:13:07 +0000 : Wesley Tanaka
Ah yes, hook_submit does exist (I didn't see it the first time in the
list). I'd suggest:
1. changing the hook_validate documentation so that the $node parameter
is no longer preceded with '&'
2. removing the claim that it's possible to make changes to the node
3. adding a reference to hook_submit for people that want to make
changes to a node.
------------------------------------------------------------------------
Sat, 16 Dec 2006 21:24:40 +0000 : plumbley
Attachment: http://drupal.org/files/issues/node.php_1.patch (1.35 KB)
+1 for this fix (remains in HEAD documentation). Combined with an out of
date node_example.module, I think this has been confusing quite a few
people for a while.
Patch for HEAD attached. Please also apply to 4.7, since it is wrong
there too.
Best wishes,
Mark.
------------------------------------------------------------------------
Sun, 17 Dec 2006 17:07:19 +0000 : pwolanin
Attachment: http://drupal.org/files/issues/node.php_2.patch (1.79 KB)
I'm not sure the & symbol matters- it can be preferable to pass large
object by reference just for speed's sake.
Also, in PHP5 all objects are passed by reference no matter the
declaration.
Also, the changes are not quite correct, since form_set_value() can be
used to make changes at the validate stage:
http://api.drupal.org/api/HEAD/function/form_set_value
Attached patch commited to HEAD version (FYI, anone with CVS access can
commit to the docs)
More information about the documentation
mailing list