Skip to content

Commit

Permalink
Merge pull request #409 from City-of-Helsinki/UHF-X_update_notificati…
Browse files Browse the repository at this point in the history
…ons_email

UHF-X Update notifications email
  • Loading branch information
khalima authored Dec 1, 2022
2 parents 66334ee + 4eb1b06 commit b607458
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions helfi_features/helfi_base_config/helfi_base_config.install
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,27 @@ function helfi_base_config_update_9013() {
$keys->delete('drupal');
}
}

/**
* Update notifications emails.
*/
function helfi_base_config_update_9014() {
$config_factory = \Drupal::configFactory();
$old_email = 'admin@example.com';
$new_email = 'drupal@hel.fi';
$emails = $config_factory
->get('update.settings')
->get('notification.emails') ?? [];

if (in_array($old_email, $emails)) {
foreach ($emails as $key => &$value) {
$value = $value === $old_email ? $new_email : $value;
}
$config_factory
->getEditable('update.settings')
->set('notification.emails', $emails)
->save();

\Drupal::messenger()->addMessage('Updated the sending address of update email notifications to drupal@hel.fi');
}
}

0 comments on commit b607458

Please sign in to comment.