Loading modules/symfony_mailer_bc/src/MailerBcConfigOverride.php +8 −0 Changes for modules/symfony_mailer_bc/src/MailerBcConfigOverride.php: 8 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -28,6 +28,14 @@ class MailerBcConfigOverride implements ConfigFactoryOverrideInterface { 'register_pending_approval' => TRUE, ]; } // The notification address is configured using Mailer Policy for // UpdateEmailBuilder. Set a dummy value in update.settings so that the // update module sends an email. if (in_array('update.settings', $names)) { $overrides['update.settings']['notification']['emails'] = ['dummy']; } return $overrides; } Loading modules/symfony_mailer_bc/src/Plugin/EmailBuilder/UpdateEmailBuilder.php +20 −0 Changes for modules/symfony_mailer_bc/src/Plugin/EmailBuilder/UpdateEmailBuilder.php: 20 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Drupal\Core\Site\Settings; use Drupal\Core\Url; use Drupal\symfony_mailer\EmailFactoryInterface; use Drupal\symfony_mailer\EmailInterface; use Drupal\symfony_mailer\Exception\SkipMailException; use Drupal\symfony_mailer\Entity\MailerPolicy; use Drupal\symfony_mailer\MailerHelperTrait; use Drupal\symfony_mailer\Processor\EmailBuilderBase; Loading @@ -17,6 +18,8 @@ use Drupal\update\UpdateManagerInterface; * @EmailBuilder( * id = "update", * sub_types = { "status_notify" = @Translation("Available updates") }, * common_adjusters = {"email_subject", "email_body", "email_to"}, * import = @Translation("Update notification addresses"), * ) */ class UpdateEmailBuilder extends EmailBuilderBase { Loading @@ -34,6 +37,10 @@ class UpdateEmailBuilder extends EmailBuilderBase { * {@inheritdoc} */ public function build(EmailInterface $email) { if (empty($email->getTo())) { throw new SkipMailException('No update notification address configured.'); } $update_config = $this->helper()->config()->get('update.settings'); $notify_all = ($update_config->get('notification.threshold') == 'all'); \Drupal::moduleHandler()->loadInclude('update', 'install'); Loading Loading @@ -61,4 +68,17 @@ class UpdateEmailBuilder extends EmailBuilderBase { } } /** * {@inheritdoc} */ public function import() { $mail_notification = implode(',',$this->helper()->config()->get('update.settings')->get('notification.emails')); if ($mail_notification) { $notification_policy = $this->helper()->policyFromAddresses($this->helper()->parseAddress($mail_notification)); $config['email_to'] = $notification_policy; MailerPolicy::import("update.status_notify", $config); } } } modules/symfony_mailer_bc/symfony_mailer_bc.module +4 −0 Changes for modules/symfony_mailer_bc/symfony_mailer_bc.module: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -77,6 +77,10 @@ function symfony_mailer_bc_form_alter(&$form, FormStateInterface $form_state, $f 'remove' => ['email', 'simplenews_sender_information', 'simplenews_subject'], 'entity' => ['node'], ], 'update_settings' => [ 'remove' => ['update_notify_emails'], 'type' => ['update'], ], 'user_admin_settings' => [ 'remove' => [ 'mail_notification_address', Loading src/Entity/MailerPolicy.php +3 −1 Changes for src/Entity/MailerPolicy.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -364,6 +364,9 @@ class MailerPolicy extends ConfigEntityBase implements EntityWithPluginCollectio * with value as an array of configured settings. */ public static function import($id, array $configuration) { $policy = static::loadOrCreate($id); $configuration += $policy->getConfiguration(); $inherited = static::loadInheritedConfig(static::parentId($id)); foreach (array_keys($configuration) as $key) { if (isset($inherited[$key]) && static::identicalArray($configuration[$key], $inherited[$key])) { Loading @@ -371,7 +374,6 @@ class MailerPolicy extends ConfigEntityBase implements EntityWithPluginCollectio } } $policy = static::loadOrCreate($id); if ($configuration) { $policy->setConfiguration($configuration)->save(); } Loading Loading
modules/symfony_mailer_bc/src/MailerBcConfigOverride.php +8 −0 Changes for modules/symfony_mailer_bc/src/MailerBcConfigOverride.php: 8 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -28,6 +28,14 @@ class MailerBcConfigOverride implements ConfigFactoryOverrideInterface { 'register_pending_approval' => TRUE, ]; } // The notification address is configured using Mailer Policy for // UpdateEmailBuilder. Set a dummy value in update.settings so that the // update module sends an email. if (in_array('update.settings', $names)) { $overrides['update.settings']['notification']['emails'] = ['dummy']; } return $overrides; } Loading
modules/symfony_mailer_bc/src/Plugin/EmailBuilder/UpdateEmailBuilder.php +20 −0 Changes for modules/symfony_mailer_bc/src/Plugin/EmailBuilder/UpdateEmailBuilder.php: 20 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Drupal\Core\Site\Settings; use Drupal\Core\Url; use Drupal\symfony_mailer\EmailFactoryInterface; use Drupal\symfony_mailer\EmailInterface; use Drupal\symfony_mailer\Exception\SkipMailException; use Drupal\symfony_mailer\Entity\MailerPolicy; use Drupal\symfony_mailer\MailerHelperTrait; use Drupal\symfony_mailer\Processor\EmailBuilderBase; Loading @@ -17,6 +18,8 @@ use Drupal\update\UpdateManagerInterface; * @EmailBuilder( * id = "update", * sub_types = { "status_notify" = @Translation("Available updates") }, * common_adjusters = {"email_subject", "email_body", "email_to"}, * import = @Translation("Update notification addresses"), * ) */ class UpdateEmailBuilder extends EmailBuilderBase { Loading @@ -34,6 +37,10 @@ class UpdateEmailBuilder extends EmailBuilderBase { * {@inheritdoc} */ public function build(EmailInterface $email) { if (empty($email->getTo())) { throw new SkipMailException('No update notification address configured.'); } $update_config = $this->helper()->config()->get('update.settings'); $notify_all = ($update_config->get('notification.threshold') == 'all'); \Drupal::moduleHandler()->loadInclude('update', 'install'); Loading Loading @@ -61,4 +68,17 @@ class UpdateEmailBuilder extends EmailBuilderBase { } } /** * {@inheritdoc} */ public function import() { $mail_notification = implode(',',$this->helper()->config()->get('update.settings')->get('notification.emails')); if ($mail_notification) { $notification_policy = $this->helper()->policyFromAddresses($this->helper()->parseAddress($mail_notification)); $config['email_to'] = $notification_policy; MailerPolicy::import("update.status_notify", $config); } } }
modules/symfony_mailer_bc/symfony_mailer_bc.module +4 −0 Changes for modules/symfony_mailer_bc/symfony_mailer_bc.module: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -77,6 +77,10 @@ function symfony_mailer_bc_form_alter(&$form, FormStateInterface $form_state, $f 'remove' => ['email', 'simplenews_sender_information', 'simplenews_subject'], 'entity' => ['node'], ], 'update_settings' => [ 'remove' => ['update_notify_emails'], 'type' => ['update'], ], 'user_admin_settings' => [ 'remove' => [ 'mail_notification_address', Loading
src/Entity/MailerPolicy.php +3 −1 Changes for src/Entity/MailerPolicy.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -364,6 +364,9 @@ class MailerPolicy extends ConfigEntityBase implements EntityWithPluginCollectio * with value as an array of configured settings. */ public static function import($id, array $configuration) { $policy = static::loadOrCreate($id); $configuration += $policy->getConfiguration(); $inherited = static::loadInheritedConfig(static::parentId($id)); foreach (array_keys($configuration) as $key) { if (isset($inherited[$key]) && static::identicalArray($configuration[$key], $inherited[$key])) { Loading @@ -371,7 +374,6 @@ class MailerPolicy extends ConfigEntityBase implements EntityWithPluginCollectio } } $policy = static::loadOrCreate($id); if ($configuration) { $policy->setConfiguration($configuration)->save(); } Loading