You are here

function hook_message_view in Message 8

Same name and namespace in other branches
  1. 7 message.api.php \hook_message_view()

Act on a message that is being assembled before rendering.

The module may add elements to $message->content prior to rendering. The structure of $message->content is a renderable array as expected by drupal_render().

Parameters

\Drupal\message\Entity\Message $message: The message entity.

string $view_mode: The view mode the message is rendered in.

string $langcode: The language code used for rendering.

See also

hook_entity_prepare_view()

hook_entity_view()

File

./message.api.php, line 32
Hooks provided by the Message module.

Code

function hook_message_view(Message $message, $view_mode, $langcode) {
  $message->content['my_additional_field'] = [
    '#markup' => 'foo',
    '#weight' => 10,
    '#theme' => 'mymodule_my_additional_field',
  ];
}