public function PetPreviewForm::validateForm in Previewable email templates 8
Same name and namespace in other branches
- 8.4 src/Form/PetPreviewForm.php \Drupal\pet\Form\PetPreviewForm::validateForm()
- 8.3 src/Form/PetPreviewForm.php \Drupal\pet\Form\PetPreviewForm::validateForm()
Form validation handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormBase::validateForm
File
- src/
Form/ PetPreviewForm.php, line 225
Class
Namespace
Drupal\pet\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$recipients_raw = $form_state
->getValue('recipients');
$recipients = [];
$errors = $this
->pet_validate_recipients($form_state, $recipients);
if (!empty($errors)) {
foreach ($errors as $error) {
$form_state
->setErrorByName('recipients', $error);
}
}
else {
$form_state
->setValue('recipients', $recipients);
$form_state
->setValue('recipients_raw', $recipients_raw);
}
}