diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-05-10 20:41:17 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-05-10 20:41:17 +0000 |
commit | 6445ba5986760d38b1f91a3f8fb1170a480c82c6 (patch) | |
tree | 6091a334b1ca0e93817c790221092060c4012b84 /modules/node/node.api.php | |
parent | 188b23087ad0c979ff47e72b148a1fb20c5603c4 (diff) | |
download | brdo-6445ba5986760d38b1f91a3f8fb1170a480c82c6.tar.gz brdo-6445ba5986760d38b1f91a3f8fb1170a480c82c6.tar.bz2 |
- Patch #367214 by alienbrain: added documentation for hook_node_build_alter and remove documentatin for hook_node_alter.
Diffstat (limited to 'modules/node/node.api.php')
-rw-r--r-- | modules/node/node.api.php | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/modules/node/node.api.php b/modules/node/node.api.php index 6b052aa5d..98f31627d 100644 --- a/modules/node/node.api.php +++ b/modules/node/node.api.php @@ -155,24 +155,6 @@ function hook_node_operations() { } /** - * Fiter, substitute or otherwise alter the $node's raw text. - * - * The $node->content array has been rendered, so the node body or - * teaser is filtered and now contains HTML. This hook should only be - * used when text substitution, filtering, or other raw text operations - * are necessary. - * - * @param $node - * The node the action is being performed on. - * @param $teaser - * The $teaser parameter from node_view(). - * @return - * None. - */ -function hook_node_alter($node, $teaser) { -} - -/** * Act on node deletion. * * @param $node @@ -408,6 +390,34 @@ function hook_node_view($node, $teaser) { } /** + * The node content was built, the module may modify the structured content. + * + * This hook is called after the content has been assembled in $node->content + * and may be used for doing processing which requires that the complete node + * content structure has been built. + * + * If the module wishes to act on the rendered HTML of the node rather than the + * structured content array, it may use this hook to add a #post_render callback. + * Alternatively, it could also implement hook_preprocess_node(). See + * drupal_render() and theme() documentation respectively for details. + * + * @param $node + * The node the action is being performed on. + * @param $teaser + * The $teaser parameter from node_build(). + */ +function hook_node_build_alter($node, $teaser) { + // Check for the existence of a field added by another module. + if (isset($node->content['an_additional_field'])) { + // Change its weight. + $node->content['an_additional_field']['#weight'] = -10; + ); + + // Add a #post_render callback to act on the rendered HTML of the node. + $node->content['#post_render'][] = 'my_module_node_post_render'; +} + +/** * Define module-provided node types. * * This is a hook used by node modules. This hook is required for modules to |