You are here

public function MessageDigest::format in Message Digest 7

Given an array of mids, build the full message content for them and combine them into one blob of email content.

File

plugins/notifier/abstract.inc, line 93

Class

MessageDigest
Message Digest notifier.

Code

public function format($digest, $view_modes) {
  $output_array = array();
  foreach ($digest as $mid) {
    $message = message_load($mid);
    if (empty($message) || !is_object($message)) {
      continue;
    }
    $rows = array();
    foreach ($view_modes as $view_mode_name => $view_mode) {
      $content = $message
        ->buildContent($view_mode_name);
      $rows[$view_mode_name] = render($content);
    }
    $output_array[] = theme('message_digest_row', array(
      'rows' => $rows,
      'plugin' => $this->plugin,
      'message' => $message,
    ));
  }
  return theme('message_digest', array(
    'messages' => $output_array,
    'plugin' => $this->plugin,
  ));
}