diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-11-07 13:35:21 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-11-07 13:35:21 +0000 |
commit | a8ec4e1d505c705ed891212cbf9149c71e4e0a31 (patch) | |
tree | 9784ad6ba7f1777614cc5de9221833f3072f9d94 /modules/comment/comment.api.php | |
parent | 803bd4f968f2d2e16c379cb915bc4fd75088bb6d (diff) | |
download | brdo-a8ec4e1d505c705ed891212cbf9149c71e4e0a31.tar.gz brdo-a8ec4e1d505c705ed891212cbf9149c71e4e0a31.tar.bz2 |
- Patch #607244 by sun: added permission to decrease performance impact of contextual links.
Diffstat (limited to 'modules/comment/comment.api.php')
-rw-r--r-- | modules/comment/comment.api.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/comment/comment.api.php b/modules/comment/comment.api.php index 104562e34..c9b8da1a3 100644 --- a/modules/comment/comment.api.php +++ b/modules/comment/comment.api.php @@ -73,6 +73,34 @@ function hook_comment_view($comment) { } /** + * The comment was built; the module may modify the structured content. + * + * This hook is called after the content has been assembled in a structured array + * and may be used for doing processing which requires that the complete comment + * content structure has been built. + * + * If the module wishes to act on the rendered HTML of the comment rather than the + * structured content array, it may use this hook to add a #post_render callback. + * Alternatively, it could also implement hook_preprocess_comment(). See + * drupal_render() and theme() documentation respectively for details. + * + * @param $build + * A renderable array representing the comment. + * + * @see comment_build() + */ +function hook_comment_build_alter($build) { + // Check for the existence of a field added by another module. + if ($build['#build_mode'] == 'full' && isset($build['an_additional_field'])) { + // Change its weight. + $build['an_additional_field']['#weight'] = -10; + } + + // Add a #post_render callback to act on the rendered HTML of the comment. + $build['#post_render'][] = 'my_module_comment_post_render'; +} + +/** * The comment is being published by the moderator. * * @param $comment |