public function SocialSwiftMailer::massageMessageBody in Open Social 8.3
Same name and namespace in other branches
- 8.9 modules/social_features/social_swiftmail/src/Plugin/Mail/SocialSwiftMailer.php \Drupal\social_swiftmail\Plugin\Mail\SocialSwiftMailer::massageMessageBody()
- 8 modules/social_features/social_swiftmail/src/Plugin/Mail/SocialSwiftMailer.php \Drupal\social_swiftmail\Plugin\Mail\SocialSwiftMailer::massageMessageBody()
- 8.2 modules/social_features/social_swiftmail/src/Plugin/Mail/SocialSwiftMailer.php \Drupal\social_swiftmail\Plugin\Mail\SocialSwiftMailer::massageMessageBody()
- 8.4 modules/social_features/social_swiftmail/src/Plugin/Mail/SocialSwiftMailer.php \Drupal\social_swiftmail\Plugin\Mail\SocialSwiftMailer::massageMessageBody()
- 8.5 modules/social_features/social_swiftmail/src/Plugin/Mail/SocialSwiftMailer.php \Drupal\social_swiftmail\Plugin\Mail\SocialSwiftMailer::massageMessageBody()
- 8.6 modules/social_features/social_swiftmail/src/Plugin/Mail/SocialSwiftMailer.php \Drupal\social_swiftmail\Plugin\Mail\SocialSwiftMailer::massageMessageBody()
- 8.7 modules/social_features/social_swiftmail/src/Plugin/Mail/SocialSwiftMailer.php \Drupal\social_swiftmail\Plugin\Mail\SocialSwiftMailer::massageMessageBody()
- 8.8 modules/social_features/social_swiftmail/src/Plugin/Mail/SocialSwiftMailer.php \Drupal\social_swiftmail\Plugin\Mail\SocialSwiftMailer::massageMessageBody()
- 10.3.x modules/social_features/social_swiftmail/src/Plugin/Mail/SocialSwiftMailer.php \Drupal\social_swiftmail\Plugin\Mail\SocialSwiftMailer::massageMessageBody()
- 10.0.x modules/social_features/social_swiftmail/src/Plugin/Mail/SocialSwiftMailer.php \Drupal\social_swiftmail\Plugin\Mail\SocialSwiftMailer::massageMessageBody()
- 10.1.x modules/social_features/social_swiftmail/src/Plugin/Mail/SocialSwiftMailer.php \Drupal\social_swiftmail\Plugin\Mail\SocialSwiftMailer::massageMessageBody()
- 10.2.x modules/social_features/social_swiftmail/src/Plugin/Mail/SocialSwiftMailer.php \Drupal\social_swiftmail\Plugin\Mail\SocialSwiftMailer::massageMessageBody()
Massages the message body into the format expected for rendering.
Parameters
array $message: The message.
Return value
array The massaged message.
File
- modules/
social_features/ social_swiftmail/ src/ Plugin/ Mail/ SocialSwiftMailer.php, line 30
Class
- SocialSwiftMailer
- Provides a 'Forced HTML SwiftMailer' plugin to send emails.
Namespace
Drupal\social_swiftmail\Plugin\MailCode
public function massageMessageBody(array $message) {
// @see: SwiftMailer::massageMessageBody()
$line_endings = Settings::get('mail_line_endings', PHP_EOL);
$message['body'] = Markup::create(implode($line_endings, array_map(function ($body) {
// If the field contains no html tags we can assume newlines will need be
// converted to <br>.
if (strlen(strip_tags($body)) === strlen($body)) {
$body = str_replace("\r", '', $body);
$body = str_replace("\n", '<br>', $body);
}
return check_markup($body, 'full_html');
}, $message['body'])));
return $message;
}