You are here

function Messaging_Send_Method::render_text in Messaging 6.3

Composes message from different parts, recursively and applies filter

Filter is applied now only once

Parameters

$text: Simple string or array of message parts It may have named elements like #prefix and #text or it may be single strings to render straight forward

$glue: Text to glue all lines together

$filter: Input format to apply to the results

1 call to Messaging_Send_Method::render_text()
Messaging_Send_Method::message_render in classes/messaging_method.class.inc
Render a template object

File

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

Class

Messaging_Send_Method
Sending method, implements all specific method functionality

Code

function render_text($text, $glue, $filter = NULL) {
  if (!$text) {
    return '';
  }
  elseif (is_array($text)) {
    $elements = array();

    // First render children recursively, without filtering
    foreach (element_children($text) as $key) {
      $elements[$key] = $this
        ->render_text($text[$key], $glue);
    }

    // Apply theme if set, just implode if not
    if (!empty($text['#theme'])) {
      $output = theme($text['#theme'], $text, $glue);
    }
    else {
      $output = implode($glue, $elements);
    }
  }
  else {
    $output = $text;
  }

  // The filter is applied now only once
  if ($filter) {
    $output = check_markup($output, $filter, FALSE);
  }
  return $output;
}