public function SocialSendEmail::execute in Open Social 8.5
Same name in this branch
- 8.5 modules/social_features/social_group/src/Plugin/Action/SocialSendEmail.php \Drupal\social_group\Plugin\Action\SocialSendEmail::execute()
- 8.5 modules/social_features/social_user/src/Plugin/Action/SocialSendEmail.php \Drupal\social_user\Plugin\Action\SocialSendEmail::execute()
Same name and namespace in other branches
- 8.9 modules/social_features/social_user/src/Plugin/Action/SocialSendEmail.php \Drupal\social_user\Plugin\Action\SocialSendEmail::execute()
- 8.6 modules/social_features/social_user/src/Plugin/Action/SocialSendEmail.php \Drupal\social_user\Plugin\Action\SocialSendEmail::execute()
- 8.7 modules/social_features/social_user/src/Plugin/Action/SocialSendEmail.php \Drupal\social_user\Plugin\Action\SocialSendEmail::execute()
- 8.8 modules/social_features/social_user/src/Plugin/Action/SocialSendEmail.php \Drupal\social_user\Plugin\Action\SocialSendEmail::execute()
- 10.3.x modules/social_features/social_user/src/Plugin/Action/SocialSendEmail.php \Drupal\social_user\Plugin\Action\SocialSendEmail::execute()
- 10.0.x modules/social_features/social_user/src/Plugin/Action/SocialSendEmail.php \Drupal\social_user\Plugin\Action\SocialSendEmail::execute()
- 10.1.x modules/social_features/social_user/src/Plugin/Action/SocialSendEmail.php \Drupal\social_user\Plugin\Action\SocialSendEmail::execute()
- 10.2.x modules/social_features/social_user/src/Plugin/Action/SocialSendEmail.php \Drupal\social_user\Plugin\Action\SocialSendEmail::execute()
2 calls to SocialSendEmail::execute()
- SocialEventManagersSendEmail::execute in modules/
social_features/ social_event/ modules/ social_event_managers/ src/ Plugin/ Action/ SocialEventManagersSendEmail.php - SocialSendEmail::execute in modules/
social_features/ social_group/ src/ Plugin/ Action/ SocialSendEmail.php
2 methods override SocialSendEmail::execute()
- SocialEventManagersSendEmail::execute in modules/
social_features/ social_event/ modules/ social_event_managers/ src/ Plugin/ Action/ SocialEventManagersSendEmail.php - SocialSendEmail::execute in modules/
social_features/ social_group/ src/ Plugin/ Action/ SocialSendEmail.php
File
- modules/
social_features/ social_user/ src/ Plugin/ Action/ SocialSendEmail.php, line 123
Class
- SocialSendEmail
- An example action covering most of the possible options.
Namespace
Drupal\social_user\Plugin\ActionCode
public function execute($entity = NULL) {
/** @var \Drupal\Core\Entity\EntityBase $entity */
if (!$entity
->getEntityTypeId() === 'user') {
$this->logger
->notice('Can not send e-mail for %entity', [
'%entity' => $entity
->getEntityTypeId() . ':' . $entity
->id(),
]);
return;
}
/** @var \Drupal\user\Entity\User $entity */
if ($entity) {
$langcode = $entity
->getPreferredLangcode();
}
else {
$langcode = $this->languageManager
->getDefaultLanguage()
->getId();
}
$params = [
'context' => $this->configuration,
];
$email = $this
->getEmail($entity);
$message = $this->mailManager
->mail('system', 'action_send_email', $email, $langcode, $params);
// Error logging is handled by \Drupal\Core\Mail\MailManager::mail().
if ($message['result']) {
$this->logger
->notice('Sent email to %recipient', [
'%recipient' => $email,
]);
}
return $this
->t('Send email');
}