You are here

public function TestHtmlMailCollector::format in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/mail_html_test/src/Plugin/Mail/TestHtmlMailCollector.php \Drupal\mail_html_test\Plugin\Mail\TestHtmlMailCollector::format()

Concatenates and wraps the email body for plain-text mails.

Parameters

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

Return value

array The formatted $message.

Overrides PhpMail::format

File

core/modules/system/tests/modules/mail_html_test/src/Plugin/Mail/TestHtmlMailCollector.php, line 25

Class

TestHtmlMailCollector
Defines a mail backend that captures sent HTML messages in the state system.

Namespace

Drupal\mail_html_test\Plugin\Mail

Code

public function format(array $message) {

  // Join the body array into one string.
  $message['body'] = implode(PHP_EOL, $message['body']);

  // Wrap the mail body for sending.
  $message['body'] = MailFormatHelper::wrapMail($message['body']);
  return $message;
}