[documentation] [Documentation task] distinguish the node type hooks from the usual hooks

RobRoy drupal-docs at drupal.org
Sat Jan 6 23:24:01 UTC 2007


Issue status update for 
http://drupal.org/node/107225
Post a follow up: 
http://drupal.org/project/comments/add/107225

 Project:      Documentation
 Version:      <none>
 Component:    Developer Guide
 Category:     tasks
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  pwolanin
 Updated by:   RobRoy
 Status:       patch (code needs review)

IMO it should remain hook_ as per the points above. -1




RobRoy



Previous comments:
------------------------------------------------------------------------

Sat, 06 Jan 2007 01:50:48 +0000 : pwolanin

Attachment: http://drupal.org/files/issues/hook-to-functor.diff (10.67 KB)

Per a recent discussion on the devel list about the confuncion between
node "hooks" (which are only called for the module defning the node
type) and normal hooks (called for all modules), came this suggestion
from chx:


http://lists.drupal.org/pipermail/development/2007-January/021677.html


Accordingly,  a patch is attached for the HEAD developer docs.  


If you don't like "functor" then remake the patch with something else
ASAP.




------------------------------------------------------------------------

Sat, 06 Jan 2007 02:01:26 +0000 : webchick

Hm. Problem is, this will still show up as "hook" documentation. I
wonder if we want a separate area to describe functors... $form_id
.'_validate' and such qualify as well, and it would be nice to get those
documented too.




------------------------------------------------------------------------

Sat, 06 Jan 2007 02:18:19 +0000 : pwolanin

I don't think the form callbacks are ever termed "hooks", are they?


Also, they are still hooks. The suggestion was really just using a
different name placeholder to distinguish them from the usual module
hooks new developers.


My only other suggestion instead of "functor" would be "nook" = "node
hook"




------------------------------------------------------------------------

Sat, 06 Jan 2007 02:35:12 +0000 : webchick

Haha, -1 to nook. ;)


Hm. When I was in IRC, I understood the definition of "functor" (the
way Drupal's using it) to be "a callback function where the prefix is
known and the suffix is one of a select list." So it seems like FAPI
callbacks would fall into that too. Not sure though.


chx???? :P




------------------------------------------------------------------------

Sat, 06 Jan 2007 02:38:24 +0000 : pwolanin

Attachment: http://drupal.org/files/issues/hook-to-nook.diff (10.7 KB)

Are you sure you don't like nook?




------------------------------------------------------------------------

Sat, 06 Jan 2007 03:11:15 +0000 : pwolanin

Attachment: http://drupal.org/files/issues/hook-to-functor_2.diff (10.97 KB)

slighly better wording, again using "functor"




------------------------------------------------------------------------

Sat, 06 Jan 2007 03:15:40 +0000 : pwolanin

Also, where is the wording at the top of this page defined: 
http://api.drupal.org/api/HEAD/group/hooks


There is a typo, and also this will need to be updated to explain
functor_ as much or more than the intro to node.php.




------------------------------------------------------------------------

Sat, 06 Jan 2007 11:19:25 +0000 : chx

Larry Garfield suggested method instead of hook: method_load,
method_view etc. I like that much bet




------------------------------------------------------------------------

Sat, 06 Jan 2007 12:33:59 +0000 : pwolanin

Attachment: http://drupal.org/files/issues/hook-to-method.diff (10.21 KB)

Works for me- method is certainly easier to understand than functor...


patch attached




------------------------------------------------------------------------

Sat, 06 Jan 2007 18:38:23 +0000 : killes at www.drop.org

I don't think this makes any sense and disapprove of such a change.




------------------------------------------------------------------------

Sat, 06 Jan 2007 19:03:05 +0000 : pwolanin

Attachment: http://drupal.org/files/issues/hook-to-typehook.diff (8.27 KB)

how about this patch- it uses the placeholder "typehook_", and adds some
other clarifications, but the term "hook" is still used to describe the
functions.   It makes these functions a little different, but doesn't
stray as far from the "hook_" convention.


(If only hook_node_info() used something like "typehook" or "type_hook"
instead of "module", I think that would also add greatly to clarifying
how this works. )




------------------------------------------------------------------------

Sat, 06 Jan 2007 19:27:06 +0000 : RobRoy

I think this may cause more confusion than it is really worth. I agree
with killes and walkah; I like the simplicity that new developers know
you can always do hook_ -> modulename_ and be okay. If we have hook_ and
method_ it will just add another layer, albeit small, to that learning
process, but if everyone agrees that it truly would make things clearer
then I'm okay with it.




------------------------------------------------------------------------

Sat, 06 Jan 2007 23:01:28 +0000 : walkah

-1 . I don't think there's any need for this , and it adds confusion.
"method_" doesn't add anything descriptive (any more than our invented
"hook"), and documentation lookups will require knowledge of which is
intended.




------------------------------------------------------------------------

Sat, 06 Jan 2007 23:22:36 +0000 : pwolanin

how about "typehook_" per the last patch?






More information about the documentation mailing list