? hook-to-functor.diff
? hook-to-nook.diff
Index: node.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/docs/developer/hooks/node.php,v
retrieving revision 1.35
diff -u -p -r1.35 node.php
--- node.php	29 Dec 2006 19:36:39 -0000	1.35
+++ node.php	6 Jan 2007 02:36:32 -0000
@@ -4,12 +4,18 @@
 /**
  * @file
  * These hooks are defined by node modules, modules that define a new kind
- * of node.
+ * of node. Some have the name placeholder "nook" instead of hook to distinguish
+ * these node type hooks (nooks) from the usual hooks.  A nook is only defined 
+ * by a module that defines a new node type and each implementation of a nook is
+ * specific to a single node type.  For example, when the 'forum' node type
+ * is loaded, the corresponding nook_load is forum_load.  This is the only
+ * nook_load that is called.  In contrast, when the 'forum' type is loaded,
+ * hook_nodeapi is called for each and every module that implements it.
  *
  * If you don't need to make a new node type but rather extend the existing
- * ones, you should instead investigate using hook_nodeapi().
+ * ones, you should be using hook_nodeapi().
  *
- * Node hooks are typically called by node.module using node_invoke().
+ * Node type nooks are typically called by node.module using node_invoke().
  */
 
 /**
@@ -35,7 +41,7 @@
  *   sub-array for each node type, with the machine-readable type name as the
  *   key. Each sub-array has up to 10 attributes. Possible attributes:
  *   - "name": the human-readable name of the node type. Required.
- *   - "module": a string telling Drupal how a module's functions map to hooks
+ *   - "module": a string telling Drupal how the node type's nooks are named
  *      (i.e. if module is defined as example_foo, then example_foo_insert will
  *      be called when inserting a node of that type). This string is usually
  *      the name of the module in question, but not always. Required.
@@ -79,7 +85,7 @@ function hook_node_info() {
 /**
  * Act on node type changes.
  *
- * This hook allows modules to take action when a node type is modified.
+ * This hook allows any module to take action when any node type is modified.
  *
  * @param $op
  *   What is being done to $info. Possible values:
@@ -110,7 +116,7 @@ function hook_node_type($op, $info) {
 /**
  * Define access restrictions.
  *
- * This hook allows node modules to limit access to the node types they
+ * This nook allows node modules to limit access to the node types they
  * define.
  *
  * @param $op
@@ -127,8 +133,8 @@ function hook_node_type($op, $info) {
  *   returned; NULL to not override the settings in the node_access table.
  *
  * The administrative account (user ID #1) always passes any access check,
- * so this hook is not called in that case. If this hook is not defined for
- * a node type, all access checks will fail, so only the administrator will
+ * so this nook is not called in that case. If this nook is not defined
+ * for a node type, all access checks will fail, so only the administrator will
  * be able to see content of that type. However, users with the "administer
  * nodes" permission may always view and edit content through the
  * administrative interface.
@@ -137,7 +143,7 @@ function hook_node_type($op, $info) {
  *
  * @ingroup node_access
  */
-function hook_access($op, $node) {
+function nook_access($op, $node) {
   global $user;
 
   if ($op == 'create') {
@@ -154,7 +160,7 @@ function hook_access($op, $node) {
 /**
  * Respond to node deletion.
  *
- * This is a hook used by node modules. It is called to allow the module
+ * This is a nook used by node modules. It is called to allow the module
  * to take action when a node is being deleted from the database by, for
  * example, deleting information from related tables.
  *
@@ -168,16 +174,16 @@ function hook_access($op, $node) {
  *
  * For a detailed usage example, see node_example.module.
  */
-function hook_delete(&$node) {
+function nook_delete(&$node) {
   db_query('DELETE FROM {mytable} WHERE nid = %d', $node->nid);
 }
 
 /**
- * This is a hook used by node modules. It is called after validation has
+ * This is a nook used by node modules. It is called after validation has
  * succeeded and before insert/update. It is used to for actions which must
  * happen only if the node is to be saved. Usually, $node is changed in some
  * way and then the actual saving of that change is left for the insert/update
- * hooks.
+ * nooks.
  *
  * @param &$node
  *   The node being saved.
@@ -186,7 +192,7 @@ function hook_delete(&$node) {
  *
  * For a detailed usage example, see fileupload.module.
  */
-function hook_submit(&$node) {
+function nook_submit(&$node) {
   // if a file was uploaded, move it to the files directory
   if ($file = file_check_upload('file')) {
     $node->file = file_save_upload($file, file_directory_path(), false);
@@ -194,8 +200,8 @@ function hook_submit(&$node) {
 }
 
 /**
- * This is a hook used by node modules. It is called after load but before the
- * node is shown on the add/edit form.
+ * This is a nook used by node modules. It is called after load but before
+ * the node is shown on the add/edit form.
  *
  * @param &$node
  *   The node being saved.
@@ -204,7 +210,7 @@ function hook_submit(&$node) {
  *
  * For a usage example, see image.module.
  */
-function hook_prepare(&$node) {
+function nook_prepare(&$node) {
   if ($file = file_check_upload($field_name)) {
     $file = file_save_upload($field_name, _image_filename($file->filename, NULL, TRUE));
     if ($file) {
@@ -226,27 +232,27 @@ function hook_prepare(&$node) {
 /**
  * Display a node editing form.
  *
- * This hook, implemented by node modules, is called to retrieve the form
+ * This nook, implemented by node modules, is called to retrieve the form
  * that is displayed when one attempts to "create/edit" an item. This form is
  * displayed at the URI http://www.example.com/?q=node/<add|edit>/nodetype.
  *
  * @param &$node
  *   The node being added or edited.
  * @param &$param
- *   The hook can set this variable to an associative array of attributes
+ *   The nook can set this variable to an associative array of attributes
  *   to add to the enclosing \<form\> tag.
  * @return
  *   An array containing the form elements to be displayed in the node
  *   edit form.
  *
  * The submit and preview buttons, taxonomy controls, and administrative
- * accoutrements are displayed automatically by node.module. This hook
+ * accoutrements are displayed automatically by node.module. This nook
  * needs to return the node title, the body text area, and fields
  * specific to the node type.
  *
  * For a detailed usage example, see node_example.module.
  */
-function hook_form(&$node, &$param) {
+function nook_form(&$node, &$param) {
   $type = node_get_types('type', $node);
 
   $form['title'] = array(
@@ -284,7 +290,7 @@ function hook_form(&$node, &$param) {
 /**
  * Respond to node insertion.
  *
- * This is a hook used by node modules. It is called to allow the module
+ * This is a nook used by node modules. It is called to allow the module
  * to take action when a new node is being inserted in the database by,
  * for example, inserting information into related tables.
  *
@@ -298,7 +304,7 @@ function hook_form(&$node, &$param) {
  *
  * For a detailed usage example, see node_example.module.
  */
-function hook_insert($node) {
+function nook_insert($node) {
   db_query("INSERT INTO {mytable} (nid, extra)
     VALUES (%d, '%s')", $node->nid, $node->extra);
 }
@@ -306,7 +312,7 @@ function hook_insert($node) {
 /**
  * Load node-type-specific information.
  *
- * This is a hook used by node modules. It is called to allow the module
+ * This is a nook used by node modules. It is called to allow the module
  * a chance to load extra information that it stores about a node, or
  * possibly replace already loaded information - which can be dangerous.
  *
@@ -323,7 +329,7 @@ function hook_insert($node) {
  *
  * For a detailed usage example, see node_example.module.
  */
-function hook_load($node) {
+function nook_load($node) {
   $additions = db_fetch_object(db_query('SELECT * FROM {mytable} WHERE nid = %s', $node->nid));
   return $additions;
 }
@@ -331,7 +337,7 @@ function hook_load($node) {
 /**
  * Respond to node updating.
  *
- * This is a hook used by node modules. It is called to allow the module
+ * This is a nook used by node modules. It is called to allow the module
  * to take action when an edited node is being updated in the database by,
  * for example, updating information in related tables.
  *
@@ -345,7 +351,7 @@ function hook_load($node) {
  *
  * For a detailed usage example, see node_example.module.
  */
-function hook_update($node) {
+function nook_update($node) {
   db_query("UPDATE {mytable} SET extra = '%s' WHERE nid = %d",
     $node->extra, $node->nid);
 }
@@ -353,7 +359,7 @@ function hook_update($node) {
 /**
  * Verify a node editing form.
  *
- * This is a hook used by node modules. It is called to allow the module
+ * This is a nook used by node modules. It is called to allow the module
  * to verify that the node is in a format valid to post to the site. 
  * Errors should be set with form_set_error().
  *
@@ -363,15 +369,15 @@ function hook_update($node) {
  * To validate nodes of all types (not just nodes of the type(s) defined by
  * this module), use hook_nodeapi() instead.
  *
- * Since Drupal 4.7, changes made to a node within hook_validate()
+ * Since Drupal 4.7, changes made to a node within nook_validate()
  * will be ignored.  The preferred method change a node's content is to 
- * use hook_submit() or hook_nodeapi($op='submit') instead.  If it is really
+ * use nook_submit() or hook_nodeapi($op='submit') instead.  If it is really
  * necessary to change the node at the validate stage, you can use function
  * form_set_value().
  *
  * For a detailed usage example, see node_example.module.
  */
-function hook_validate($node) {
+function nook_validate($node) {
   if (isset($node->end) && isset($node->start)) {
     if ($node->start > $node->end) {
       form_set_error('time', t('An event may not end before it starts.'));
@@ -382,7 +388,7 @@ function hook_validate($node) {
 /**
  * Display a node.
  *
- * This is a hook used by node modules. It allows a module to define a
+ * This is a nook used by node modules. It allows a module to define a
  * custom method of displaying its nodes, usually by displaying extra
  * information particular to that node type.
  *
@@ -410,7 +416,7 @@ function hook_validate($node) {
  *
  * For a detailed usage example, see node_example.module.
  */
-function hook_view($node, $teaser = FALSE, $page = FALSE) {
+function nook_view($node, $teaser = FALSE, $page = FALSE) {
   if ($page) {
     $breadcrumb = array();
     $breadcrumb[] = array('path' => 'example', 'title' => t('example'));
