| 1 |
<?php |
<?php |
| 2 |
// $Id: comment.api.php,v 1.11 2009/08/17 13:10:45 webchick Exp $ |
// $Id: comment.api.php,v 1.12 2009/10/10 13:37:09 dries Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 73 |
} |
} |
| 74 |
|
|
| 75 |
/** |
/** |
| 76 |
|
* The comment was built; the module may modify the structured content. |
| 77 |
|
* |
| 78 |
|
* This hook is called after the content has been assembled in a structured array |
| 79 |
|
* and may be used for doing processing which requires that the complete comment |
| 80 |
|
* content structure has been built. |
| 81 |
|
* |
| 82 |
|
* If the module wishes to act on the rendered HTML of the comment rather than the |
| 83 |
|
* structured content array, it may use this hook to add a #post_render callback. |
| 84 |
|
* Alternatively, it could also implement hook_preprocess_comment(). See |
| 85 |
|
* drupal_render() and theme() documentation respectively for details. |
| 86 |
|
* |
| 87 |
|
* @param $build |
| 88 |
|
* A renderable array representing the comment. |
| 89 |
|
* |
| 90 |
|
* @see comment_build() |
| 91 |
|
*/ |
| 92 |
|
function hook_comment_build_alter($build) { |
| 93 |
|
// Check for the existence of a field added by another module. |
| 94 |
|
if ($build['#build_mode'] == 'full' && isset($build['an_additional_field'])) { |
| 95 |
|
// Change its weight. |
| 96 |
|
$build['an_additional_field']['#weight'] = -10; |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
// Add a #post_render callback to act on the rendered HTML of the comment. |
| 100 |
|
$build['#post_render'][] = 'my_module_comment_post_render'; |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
/** |
| 104 |
* The comment is being published by the moderator. |
* The comment is being published by the moderator. |
| 105 |
* |
* |
| 106 |
* @param $comment |
* @param $comment |