You are here

static function Messaging_Method::default_render in Messaging 6.4

Renders full message with header and body

Parameters

$message: Message object

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

1 call to Messaging_Method::default_render()
Messaging_Send_Method::message_render in includes/messaging_method.class.inc
Renders full message with header and body

File

includes/messaging_method.class.inc, line 87
Drupal Messaging Framework - Send_Method class file

Class

Messaging_Method
Base class for all Incoming and Sending methods

Code

static function default_render($message, $info = array()) {
  messaging_include('text.inc');
  messaging_debug('Rendering message', array(
    'message' => $message,
    'info' => $info,
  ));

  // 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' => ' ',
    'body_format' => NULL,
    'filter' => NULL,
  );
  $message->subject = self::check_subject(self::text_render($message->subject, $info['subject_glue']));
  $message->body = self::text_render($message->body, $info['glue'], $info['body_format'], $info['filter']);
  $message->rendered = TRUE;
  messaging_debug('Rendered message', array(
    'message' => array(
      'subject' => $message->subject,
      'body' => $message->body,
    ),
    'info' => $info,
  ));
  return $message;
}