You are here

function globallink_mail in GlobalLink Connect for Drupal 8.2

Same name and namespace in other branches
  1. 8 globallink.module \globallink_mail()

Implements hook_mail().

File

./globallink.module, line 94

Code

function globallink_mail($key, &$message, $params) {

  /** @var \Drupal\tmgmt\MessageInterface $tmgmt_message */
  $tmgmt_message = $params['message'];
  $langcode = $message['langcode'];
  switch ($key) {
    case 'log':
      $message['subject'] = t('Translations.com: new message from @site_name', [
        '@site_name' => \Drupal::config('system.site')
          ->get('name'),
      ], [
        'langcode' => $langcode,
      ]);
      $message['body'][] = t('New log message from translations.com service: @message.', [
        '@message' => $tmgmt_message
          ->getMessage(),
      ]);
      break;
  }
}