You are here

function messaging_message_render in Messaging 6

Same name and namespace in other branches
  1. 5 messaging.module \messaging_message_render()
  2. 6.2 messaging.module \messaging_message_render()

Renders full message with header and body

Parameters

$message: Message object

$info: Sending method info for rendering (glue and filter options)

4 calls to messaging_message_render()
Messaging_API_Tests::testMessagingBasicAPI in tests/messaging_api.test
Exercise basic API functions
Messaging_API_Tests::testMessagingSendingAPI in tests/messaging_api.test
Play with creating, retrieving, deleting a pair messages
messaging_message_send_user in ./messaging.module
Send message to user represented by account
messaging_sms_render in messaging_sms/messaging_sms.module
Message Render callback

File

./messaging.module, line 633

Code

function messaging_message_render($message, $info) {
  if (!empty($message->rendered)) {
    return $message;
  }

  // Apply footer prefix if provided and the message has a footer element.
  // Note: If message body is a string the final isset($message['body']['footer']) will be true
  if (!empty($info['footer']) && is_array($message->body) && isset($message->body['footer'])) {
    $message->body['footer'] = array(
      '#prefix' => $info['footer'],
      '#text' => $message->body['footer'],
    );
  }

  // Render separately subject and body info, adding default parameters
  $info += array(
    'glue' => '',
    'subject_glue' => '',
    'filter' => NULL,
  );
  $message->subject = messaging_check_subject(messaging_text_render($message->subject, $info['subject_glue']));
  $message->body = messaging_text_render($message->body, $info['glue'], $info['filter']);
  $message->rendered = 1;
  return $message;
}