You are here

public function EmailAction::validateConfigurationForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php \Drupal\Core\Action\Plugin\Action\EmailAction::validateConfigurationForm()
  2. 9 core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php \Drupal\Core\Action\Plugin\Action\EmailAction::validateConfigurationForm()

File

core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php, line 192

Class

EmailAction
Sends an email message.

Namespace

Drupal\Core\Action\Plugin\Action

Code

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  if (!$this->emailValidator
    ->isValid($form_state
    ->getValue('recipient')) && strpos($form_state
    ->getValue('recipient'), ':mail') === FALSE) {

    // We want the literal %author placeholder to be emphasized in the error message.
    $form_state
      ->setErrorByName('recipient', t('Enter a valid email address or use a token email address such as %author.', [
      '%author' => '[node:author:mail]',
    ]));
  }
}