You are here

protected function SystemEmailToUsersOfRole::doExecute in Apigee Edge 8

Sends an email to all users of the specified role(s).

Parameters

\Drupal\user\RoleInterface[] $roles: Array of user roles.

string $subject: Subject of the email.

string $message: Email message text.

string $reply: (optional) Reply to email address.

\Drupal\Core\Language\LanguageInterface $language: (optional) Language object. If not specified, email will be sent to each recipient in the recipient's preferred language.

Overrides SystemEmailToUsersOfRole::doExecute

File

modules/apigee_edge_actions/src/Plugin/RulesAction/SystemEmailToUsersOfRole.php, line 84

Class

SystemEmailToUsersOfRole
Overrides Rules SystemEmailToUsersOfRole to fix parameter upcasting.

Namespace

Drupal\apigee_edge_actions\Plugin\RulesAction

Code

protected function doExecute(array $roles, $subject, $message, $reply = NULL, LanguageInterface $language = NULL) {

  // SystemMailToUsersOfRole::doExecute() expects an array of RoleInterface.
  // Upcast $roles from string[] to RoleInterface[].
  // @see https://www.drupal.org/project/rules/issues/2800749
  $roles = $this->roleStorage
    ->loadMultiple($roles);
  parent::doExecute($roles, $subject, $message, $reply, $language);
}