public function EmailAction::validateConfigurationForm in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php \Drupal\Core\Action\Plugin\Action\EmailAction::validateConfigurationForm()
Form validation handler.
Parameters
array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().
Overrides ConfigurableActionBase::validateConfigurationForm
File
- core/
lib/ Drupal/ Core/ Action/ Plugin/ Action/ EmailAction.php, line 192
Class
- EmailAction
- Sends an email message.
Namespace
Drupal\Core\Action\Plugin\ActionCode
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]',
]));
}
}