public function TeamInvitationNotifierEmail::sendNotificationsFor in Apigee Edge 8
Sends notification for the provided team_invitation.
Parameters
\Drupal\apigee_edge_teams\Entity\TeamInvitationInterface $team_invitation: The team_invitation entity.
Return value
bool TRUE if notifications successfully sent. FALSE otherwise.
Overrides TeamInvitationNotifierInterface::sendNotificationsFor
File
- modules/
apigee_edge_teams/ src/ TeamInvitationNotifierEmail.php, line 62
Class
- TeamInvitationNotifierEmail
- Handles notifications for team_invitation via email.
Namespace
Drupal\apigee_edge_teamsCode
public function sendNotificationsFor(TeamInvitationInterface $team_invitation) : bool {
$email = $team_invitation
->getRecipient();
$langcode = $this->languageManager
->getDefaultLanguage()
->getId();
$params = [
'team_invitation' => $team_invitation,
'user' => NULL,
];
/** @var \Drupal\user\UserInterface $user */
$user = user_load_by_mail($email);
if ($user) {
$langcode = $user
->getPreferredLangcode();
$params['user'] = $user;
}
// Send email notification.
$message = $this->mailManager
->mail('apigee_edge_teams', 'team_invitation_created', $email, $langcode, $params);
return $message['result'];
}