function hook_message_view_alter in Message 7
Same name and namespace in other branches
- 8 message.api.php \hook_message_view_alter()
Alter the results of entity_view() for messages.
Parameters
$build: A renderable array representing the message 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 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.
See also
1 function implements hook_message_view_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- message_message_view_alter in ./
message.module - Implements hook_message_view_alter().
File
- ./
message.api.php, line 56 - Hooks provided by the Message module.
Code
function hook_message_view_alter(&$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';
}
}