You are here

function private_message_update_8001 in Private Message 8

Same name and namespace in other branches
  1. 8.2 private_message.install \private_message_update_8001()

Implements hook_update_n().

File

./private_message.install, line 19
Holds install and update hooks for the Private Messsage module.

Code

function private_message_update_8001() {
  $config_factory = \Drupal::configFactory();
  $config_factory
    ->getEditable('private_message.settings')
    ->set('enable_email_notifications', TRUE)
    ->set('send_by_default', TRUE)
    ->save(TRUE);
  $message_notifcation_mail_map = [
    'subject' => 'Private message at [site:name]',
    'body' => "[user:display-name],\n\nYou have received a private message at [site:name] from [private_message:author_name]\n\nThe message is as follows:\n\n[private_message:message]\n\nYou can view the entire thread and reply to this message at:\n\n[private_message_thread:url]\n\n\nThank you,\n\n--  [site:name]",
  ];
  $config_factory
    ->getEditable('private_message.mail')
    ->set('message_notification', $message_notifcation_mail_map)
    ->save(TRUE);
}