[documentation] [Documentation feature] hook_load and hook_view
peterx
drupal-docs at drupal.org
Mon Jan 22 06:03:56 UTC 2007
Issue status update for
http://drupal.org/node/111560
Post a follow up:
http://drupal.org/project/comments/add/111560
Project: Documentation
Version: <none>
Component: Developer Guide
Category: feature requests
Priority: normal
Assigned to: Anonymous
Reported by: peterx
Updated by: peterx
Status: active
Some questions about hooks are not obvious in the 5.0 API documentation
so I made some notes that could be useful. The extra information is
mostly about the sequence of hooks.
Here are the notes. If the API pages had comments, we could add the
comments direct to the pages for later incorporation into the
documentation after review.
http://api.drupal.org/api/HEAD/function/hook_load
Usage
hook_load is called by node.php in node_load to load the extra data
your module adds to the node. node_load then calls the nodeapi hooks in
all modules to give them a chance to modify the node. As an example,
author.module creates nodes of type author and defines author_load to
add web site information to author nodes. Any other module can then use
hook_nodeapi to change the author nodes. The node is then available for
viewing and updating.
hook_view is called after hook_load to modify the node for presentation
during the themeing process. hook_load loads the data that goes into a
node update form and back into the database. If data needs an extra
modification just for display on a Web page then perform the extra
modification in hook_view.
http://api.drupal.org/api/HEAD/function/hook_view
Usage
hook_view is called after hook_load and hook_nodeapi. hook_load adds
additional data for a specific node type, nodeapi then lets any module
modify the node and finally hook_view prepares the node for viewing. You
could use hook_view to translate raw data inserted by another module.
peterx
More information about the documentation
mailing list