Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663

This commit is contained in:
Greg Anderson 2015-10-08 11:40:12 -07:00
parent eb34d130a8
commit f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions

View file

@ -53,7 +53,8 @@ interface MailInterface {
* - User <user@example.com>
* - User <user@example.com>, Another User <anotheruser@example.com>
* - subject: Subject of the email to be sent. This must not contain any
* newline characters, or the mail may not be sent properly.
* newline characters, or the mail may not be sent properly. The subject
* is converted to plain text by the mail plugin manager.
* - body: Message to be sent. Accepts both CRLF and LF line-endings.
* Email bodies must be wrapped. For smart plain text wrapping you can use
* \Drupal\Core\Mail\MailFormatHelper::wrapMail() .

View file

@ -7,6 +7,7 @@
namespace Drupal\Core\Mail;
use Drupal\Component\Render\PlainTextOutput;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\Core\Cache\CacheBackendInterface;
@ -222,6 +223,12 @@ class MailManager extends DefaultPluginManager implements MailManagerInterface {
}
// Sending was originally requested and was not canceled.
else {
// Ensure that subject is plain text. By default translated and
// formatted strings are prepared for the HTML context and email
// subjects are plain strings.
if ($message['subject']) {
$message['subject'] = PlainTextOutput::renderFromHtml($message['subject']);
}
$message['result'] = $system->mail($message);
// Log errors.
if (!$message['result']) {

View file

@ -67,8 +67,8 @@ interface MailManagerInterface extends PluginManagerInterface {
* $message['send'] = FALSE;
* break;
* }
* $message['subject'] = t('Notification from !site', $variables, $options);
* $message['body'][] = t("Dear !username\n\nThere is new content available on the site.", $variables, $options);
* $message['subject'] = t('Notification from @site', $variables, $options);
* $message['body'][] = t("Dear @username\n\nThere is new content available on the site.", $variables, $options);
* break;
* }
* }

View file

@ -35,6 +35,7 @@ class PhpMail implements MailInterface {
public function format(array $message) {
// Join the body array into one string.
$message['body'] = implode("\n\n", $message['body']);
// Convert any HTML to plain-text.
$message['body'] = MailFormatHelper::htmlToText($message['body']);
// Wrap the mail body for sending.