Loading modules/symfony_mailer_bc/config/optional/symfony_mailer.mailer_policy.user.status_blocked.yml +2 Changes for modules/symfony_mailer_bc/config/optional/symfony_mailer.mailer_policy.user.status_blocked.yml: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -13,3 +13,5 @@ configuration: <p>[user:display-name],</p> <p>Your account on <a href="[site:url]">[site:name]</a> has been blocked.</p> format: email_html email_skip_sending: message: 'Notification disabled in settings' modules/symfony_mailer_bc/config/optional/symfony_mailer.mailer_policy.user.status_canceled.yml +2 Changes for modules/symfony_mailer_bc/config/optional/symfony_mailer.mailer_policy.user.status_canceled.yml: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -13,3 +13,5 @@ configuration: <p>[user:display-name],</p> <p>Your account on <a href="[site:url]">[site:name]</a> has been canceled.</p> format: email_html email_skip_sending: message: 'Notification disabled in settings' modules/symfony_mailer_bc/src/MailerBcConfigOverride.php +55 Changes for modules/symfony_mailer_bc/src/MailerBcConfigOverride.php: 55 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\symfony_mailer_bc; use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Config\ConfigFactoryOverrideInterface; use Drupal\Core\Config\StorageInterface; /** * Example configuration override. */ class MailerBcConfigOverride implements ConfigFactoryOverrideInterface { /** * {@inheritdoc} */ public function loadOverrides($names) { $overrides = []; if (in_array('user.setting', $names)) { $overrides['user.setting']['notify'] = [ 'cancel_confirm' => TRUE, 'password_reset' => TRUE, 'status_activated' => TRUE, 'status_blocked' => TRUE, 'status_canceled' => TRUE, 'register_admin_created' => TRUE, 'register_no_approval_required' => TRUE, 'register_pending_approval' => TRUE, ]; } return $overrides; } /** * {@inheritdoc} */ public function getCacheSuffix() { return 'MailerBcConfigOverride'; } /** * {@inheritdoc} */ public function getCacheableMetadata($name) { return new CacheableMetadata(); } /** * {@inheritdoc} */ public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) { return NULL; } } modules/symfony_mailer_bc/src/Plugin/EmailBuilder/ContactPageEmailBuilder.php +24 −1 Changes for modules/symfony_mailer_bc/src/Plugin/EmailBuilder/ContactPageEmailBuilder.php: 24 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,8 +2,12 @@ namespace Drupal\symfony_mailer_bc\Plugin\EmailBuilder; use Drupal\contact\Entity\ContactForm; use Drupal\Core\Url; use Drupal\symfony_mailer\EmailInterface; use Drupal\symfony_mailer\Entity\MailerPolicy; use Drupal\symfony_mailer\MailerHelperTrait; use Drupal\symfony_mailer\Processor\MailerPolicyImportInterface; /** * Defines the Email Builder plug-in for contact module page forms. Loading @@ -16,12 +20,16 @@ use Drupal\symfony_mailer\EmailInterface; * "autoreply" = @Translation("Auto-reply"), * }, * has_entity = TRUE, * common_adjusters = {"email_subject", "email_from"}, * import = @Translation("Contact form recipients"), * ) * * @todo Notes for adopting Symfony Mailer into Drupal core. This builder can * set langcode, to, reply-to so the calling code doesn't need to. */ class ContactPageEmailBuilder extends ContactEmailBuilderBase { class ContactPageEmailBuilder extends ContactEmailBuilderBase implements MailerPolicyImportInterface { use MailerHelperTrait; /** * {@inheritdoc} Loading @@ -36,4 +44,19 @@ class ContactPageEmailBuilder extends ContactEmailBuilderBase { } } /** * {@inheritdoc} */ public function import() { $helper = $this->helper(); foreach (ContactForm::loadMultiple() as $id => $form) { if ($id != 'personal') { $addresses = $helper->parseAddress(implode(',', $form->getRecipients())); $config['email_to'] = $helper->policyFromAddresses($addresses); MailerPolicy::import("contact_form.mail.$id", $config); } } } } modules/symfony_mailer_bc/src/Plugin/EmailBuilder/UserEmailBuilder.php +48 −2 Changes for modules/symfony_mailer_bc/src/Plugin/EmailBuilder/UserEmailBuilder.php: 48 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -2,9 +2,12 @@ namespace Drupal\symfony_mailer_bc\Plugin\EmailBuilder; use Drupal\symfony_mailer\EmailInterface; use Drupal\symfony_mailer\Entity\MailerPolicy; use Drupal\symfony_mailer\MailerHelperTrait; use Drupal\symfony_mailer\Processor\EmailProcessorBase; use Drupal\symfony_mailer\Processor\MailerPolicyImportInterface; use Drupal\symfony_mailer\Processor\TokenProcessorTrait; use Drupal\symfony_mailer\EmailInterface; /** * Defines the Email Builder plug-in for user module. Loading @@ -22,19 +25,62 @@ use Drupal\symfony_mailer\EmailInterface; * "status_blocked" = @Translation("Account blocked"), * "status_canceled" = @Translation("Account cancelled"), * }, * common_adjusters = {"email_subject", "email_body"}, * import = @Translation("User email settings"), * import_warning = @Translation("This overrides the default HTML messages with imported plain text versions."), * ) * * @todo Notes for adopting Symfony Mailer into Drupal core. This builder can * set langcode, to, reply-to so the calling code doesn't need to. */ class UserEmailBuilder extends EmailProcessorBase { class UserEmailBuilder extends EmailProcessorBase implements MailerPolicyImportInterface { use MailerHelperTrait; use TokenProcessorTrait; /** * {@inheritdoc} */ public function preRender(EmailInterface $email) { if ($email->getSubType() != 'register_pending_approval_admin') { $email->setTo($email->getParam('user')->getEmail()); } $this->tokenOptions(['callback' => 'user_mail_tokens', 'clear' => TRUE]); } /** * {@inheritdoc} */ public function import() { $config_factory = $this->helper()->config(); $notify = $config_factory->get('user.settings')->get('notify'); $mail = $config_factory->get('user.mail')->get(); unset($mail['langcode']); if ($mail_notification = $config_factory->get('system.site')->get('mail_notification')) { $notification_policy = $this->helper()->policyFromAddresses($this->helper()->parseAddress($mail_notification)); $config['email_reply_to'] = $notification_policy; MailerPolicy::import("user", $config); } foreach ($mail as $sub_type => $values) { $config = [ 'email_subject' => ['value' => $values["subject"]], 'email_body' => [ 'content' => [ 'value' => $values["body"], 'format' => 'plain_text', ], ], ]; if (isset($notify[$sub_type]) && !$notify[$sub_type]) { $config['email_skip_sending']['message'] = 'Notification disabled in settings'; } if (($sub_type == 'register_pending_approval_admin') && isset($notification_policy)) { $config['email_to'] = $notification_policy; } MailerPolicy::import("user.$sub_type", $config); } } } Loading
modules/symfony_mailer_bc/config/optional/symfony_mailer.mailer_policy.user.status_blocked.yml +2 Changes for modules/symfony_mailer_bc/config/optional/symfony_mailer.mailer_policy.user.status_blocked.yml: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -13,3 +13,5 @@ configuration: <p>[user:display-name],</p> <p>Your account on <a href="[site:url]">[site:name]</a> has been blocked.</p> format: email_html email_skip_sending: message: 'Notification disabled in settings'
modules/symfony_mailer_bc/config/optional/symfony_mailer.mailer_policy.user.status_canceled.yml +2 Changes for modules/symfony_mailer_bc/config/optional/symfony_mailer.mailer_policy.user.status_canceled.yml: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -13,3 +13,5 @@ configuration: <p>[user:display-name],</p> <p>Your account on <a href="[site:url]">[site:name]</a> has been canceled.</p> format: email_html email_skip_sending: message: 'Notification disabled in settings'
modules/symfony_mailer_bc/src/MailerBcConfigOverride.php +55 Changes for modules/symfony_mailer_bc/src/MailerBcConfigOverride.php: 55 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\symfony_mailer_bc; use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Config\ConfigFactoryOverrideInterface; use Drupal\Core\Config\StorageInterface; /** * Example configuration override. */ class MailerBcConfigOverride implements ConfigFactoryOverrideInterface { /** * {@inheritdoc} */ public function loadOverrides($names) { $overrides = []; if (in_array('user.setting', $names)) { $overrides['user.setting']['notify'] = [ 'cancel_confirm' => TRUE, 'password_reset' => TRUE, 'status_activated' => TRUE, 'status_blocked' => TRUE, 'status_canceled' => TRUE, 'register_admin_created' => TRUE, 'register_no_approval_required' => TRUE, 'register_pending_approval' => TRUE, ]; } return $overrides; } /** * {@inheritdoc} */ public function getCacheSuffix() { return 'MailerBcConfigOverride'; } /** * {@inheritdoc} */ public function getCacheableMetadata($name) { return new CacheableMetadata(); } /** * {@inheritdoc} */ public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) { return NULL; } }
modules/symfony_mailer_bc/src/Plugin/EmailBuilder/ContactPageEmailBuilder.php +24 −1 Changes for modules/symfony_mailer_bc/src/Plugin/EmailBuilder/ContactPageEmailBuilder.php: 24 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,8 +2,12 @@ namespace Drupal\symfony_mailer_bc\Plugin\EmailBuilder; use Drupal\contact\Entity\ContactForm; use Drupal\Core\Url; use Drupal\symfony_mailer\EmailInterface; use Drupal\symfony_mailer\Entity\MailerPolicy; use Drupal\symfony_mailer\MailerHelperTrait; use Drupal\symfony_mailer\Processor\MailerPolicyImportInterface; /** * Defines the Email Builder plug-in for contact module page forms. Loading @@ -16,12 +20,16 @@ use Drupal\symfony_mailer\EmailInterface; * "autoreply" = @Translation("Auto-reply"), * }, * has_entity = TRUE, * common_adjusters = {"email_subject", "email_from"}, * import = @Translation("Contact form recipients"), * ) * * @todo Notes for adopting Symfony Mailer into Drupal core. This builder can * set langcode, to, reply-to so the calling code doesn't need to. */ class ContactPageEmailBuilder extends ContactEmailBuilderBase { class ContactPageEmailBuilder extends ContactEmailBuilderBase implements MailerPolicyImportInterface { use MailerHelperTrait; /** * {@inheritdoc} Loading @@ -36,4 +44,19 @@ class ContactPageEmailBuilder extends ContactEmailBuilderBase { } } /** * {@inheritdoc} */ public function import() { $helper = $this->helper(); foreach (ContactForm::loadMultiple() as $id => $form) { if ($id != 'personal') { $addresses = $helper->parseAddress(implode(',', $form->getRecipients())); $config['email_to'] = $helper->policyFromAddresses($addresses); MailerPolicy::import("contact_form.mail.$id", $config); } } } }
modules/symfony_mailer_bc/src/Plugin/EmailBuilder/UserEmailBuilder.php +48 −2 Changes for modules/symfony_mailer_bc/src/Plugin/EmailBuilder/UserEmailBuilder.php: 48 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -2,9 +2,12 @@ namespace Drupal\symfony_mailer_bc\Plugin\EmailBuilder; use Drupal\symfony_mailer\EmailInterface; use Drupal\symfony_mailer\Entity\MailerPolicy; use Drupal\symfony_mailer\MailerHelperTrait; use Drupal\symfony_mailer\Processor\EmailProcessorBase; use Drupal\symfony_mailer\Processor\MailerPolicyImportInterface; use Drupal\symfony_mailer\Processor\TokenProcessorTrait; use Drupal\symfony_mailer\EmailInterface; /** * Defines the Email Builder plug-in for user module. Loading @@ -22,19 +25,62 @@ use Drupal\symfony_mailer\EmailInterface; * "status_blocked" = @Translation("Account blocked"), * "status_canceled" = @Translation("Account cancelled"), * }, * common_adjusters = {"email_subject", "email_body"}, * import = @Translation("User email settings"), * import_warning = @Translation("This overrides the default HTML messages with imported plain text versions."), * ) * * @todo Notes for adopting Symfony Mailer into Drupal core. This builder can * set langcode, to, reply-to so the calling code doesn't need to. */ class UserEmailBuilder extends EmailProcessorBase { class UserEmailBuilder extends EmailProcessorBase implements MailerPolicyImportInterface { use MailerHelperTrait; use TokenProcessorTrait; /** * {@inheritdoc} */ public function preRender(EmailInterface $email) { if ($email->getSubType() != 'register_pending_approval_admin') { $email->setTo($email->getParam('user')->getEmail()); } $this->tokenOptions(['callback' => 'user_mail_tokens', 'clear' => TRUE]); } /** * {@inheritdoc} */ public function import() { $config_factory = $this->helper()->config(); $notify = $config_factory->get('user.settings')->get('notify'); $mail = $config_factory->get('user.mail')->get(); unset($mail['langcode']); if ($mail_notification = $config_factory->get('system.site')->get('mail_notification')) { $notification_policy = $this->helper()->policyFromAddresses($this->helper()->parseAddress($mail_notification)); $config['email_reply_to'] = $notification_policy; MailerPolicy::import("user", $config); } foreach ($mail as $sub_type => $values) { $config = [ 'email_subject' => ['value' => $values["subject"]], 'email_body' => [ 'content' => [ 'value' => $values["body"], 'format' => 'plain_text', ], ], ]; if (isset($notify[$sub_type]) && !$notify[$sub_type]) { $config['email_skip_sending']['message'] = 'Notification disabled in settings'; } if (($sub_type == 'register_pending_approval_admin') && isset($notification_policy)) { $config['email_to'] = $notification_policy; } MailerPolicy::import("user.$sub_type", $config); } } }