You are here

function Messaging_Send_Method::message_render in Messaging 6.3

Same name and namespace in other branches
  1. 6.4 includes/messaging_method.class.inc \Messaging_Send_Method::message_render()
  2. 7 messaging.method.inc \Messaging_Send_Method::message_render()

Render a template object

It builds subject and body properties

File

classes/messaging_method.class.inc, line 183
Drupal Messaging Framework - Send_Method class file

Class

Messaging_Send_Method
Sending method, implements all specific method functionality

Code

function message_render($template) {
  $info = $this->info + array(
    'glue' => ' ',
    'filter' => NULL,
  );

  // Render body if anything to render
  if ($body = $template->body) {

    // Apply footer prefix if provided and the message has a footer element.
    // Note: If $body is a string the final isset($body['footer']) will be true
    if (is_array($body) && !empty($info['footer']) && isset($body['footer'])) {
      $body['footer_prefix'] = $info['footer'];
      $body['footer_text'] = $body['footer'];
      unset($body['footer']);
    }
    $template->body = $this
      ->render_text($body, $info['glue'], $info['filter']);
  }

  // Render subject if anything to render
  if ($subject = $template->subject) {

    // Render separately subject and body info, adding default parameters
    $info += array(
      'subject_glue' => ' ',
    );
    $template->subject = $this
      ->check_subject($this
      ->render_text($subject, $info['subject_glue']));
  }
  return $template;
}