You are here

function role_watchdog_mail in Role Watchdog 8

Same name and namespace in other branches
  1. 6.2 role_watchdog.module \role_watchdog_mail()
  2. 6 role_watchdog.module \role_watchdog_mail()
  3. 7.2 role_watchdog.module \role_watchdog_mail()
  4. 7 role_watchdog.module \role_watchdog_mail()

Implements hook_mail().

File

./role_watchdog.module, line 101
Contains role_watchdog.module.

Code

function role_watchdog_mail($key, &$message, $params) {
  $options = [
    'langcode' => $message['langcode'],
  ];
  switch ($key) {
    case 'notification':
      $message['from'] = \Drupal::config('system.site')
        ->get('mail');
      $message['subject'] = t('Role watchdog notification on @site.', [
        '@site' => \Drupal::config('system.site')
          ->get('name'),
      ], $options);
      $message['body'][] = $params['message'];
      break;
  }
}