You are here

function messaging_message_render in Messaging 5

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

Renders full message with header and body

Parameters

$message: Message array

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

3 calls to messaging_message_render()
Messaging_API_Tests::testMessagingBasicAPI in tests/messaging_api.test
Play with creating, retrieving, deleting a pair messages
messaging_message_send in ./messaging.module
Send message to array of destinations. The message is rendered just once.
messaging_sms_render_message in messaging_sms/messaging_sms.module
Message Render callback

File

./messaging.module, line 790

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' => '',
  );
  $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;
}