You are here

function apigee_edge_teams_mail in Apigee Edge 8

Implements hook_mail().

File

modules/apigee_edge_teams/apigee_edge_teams.module, line 316
Copyright 2018 Google Inc.

Code

function apigee_edge_teams_mail($key, &$message, $params) {
  $token_service = \Drupal::token();
  $config = \Drupal::config('apigee_edge_teams.team_settings');
  switch ($key) {
    case 'team_invitation_created':
      $template = empty($params['user']) ? 'new' : 'existing';
      $message['subject'] = PlainTextOutput::renderFromHtml($token_service
        ->replace($config
        ->get("team_invitation_email_{$template}.subject"), $params));
      $message['body'][] = $token_service
        ->replace($config
        ->get("team_invitation_email_{$template}.body"), $params);
      break;
  }
}