You are here

public function PostmarkMail::format in Postmark 8

Concatenate and wrap the e-mail body for either plain-text or HTML e-mails.

Parameters

array $message: A message array, as described in hook_mail_alter().

Return value

array The formatted $message.

Overrides MailInterface::format

File

src/Plugin/Mail/PostmarkMail.php, line 82

Class

PostmarkMail
Modify the Drupal mail system to use Postmark when sending emails.

Namespace

Drupal\postmark\Plugin\Mail

Code

public function format(array $message) {

  // Join the body array into one string.
  if (is_array($message['body'])) {
    $message['body'] = implode("\n\n", $message['body']);
  }

  // If text format is specified in settings, run the message through it.
  $format = $this->config
    ->get('format_filter');
  if (!empty($format)) {
    $message['body'] = check_markup($message['body'], $format, $message['langcode']);
  }
  return $message;
}