function hook_message_view_alter in Message 8
Same name and namespace in other branches
- 7 message.api.php \hook_message_view_alter()
Alter the results of entity_view() for messages.
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 message content structure has been built.
If the module wishes to act on the rendered HTML of the message rather than the structured content array, it may use this hook to add a #post_render callback. Alternatively, it could also implement hook_preprocess_message(). See drupal_render() and theme() documentation respectively for details.
Parameters
array $build: A renderable array representing the message content.
See also
File
- ./
message.api.php, line 57 - Hooks provided by the Message module.
Code
function hook_message_view_alter(array &$build) {
if ($build['#view_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 entity.
$build['#post_render'][] = 'my_module_post_render';
}
}