public function TestYamlFormHandler::validateForm in YAML Form 8
Validate form submission form .
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
\Drupal\yamlform\YamlFormSubmissionInterface $yamlform_submission: A form submission.
Overrides YamlFormHandlerBase::validateForm
File
- tests/
modules/ yamlform_test/ src/ Plugin/ YamlFormHandler/ TestYamlFormHandler.php, line 71
Class
- TestYamlFormHandler
- Form submission test handler.
Namespace
Drupal\yamlform_test\Plugin\YamlFormHandlerCode
public function validateForm(array &$form, FormStateInterface $form_state, YamlFormSubmissionInterface $yamlform_submission) {
$this
->displayMessage(__FUNCTION__);
if ($value = $form_state
->getValue('element')) {
$form_state
->setErrorByName('element', $this
->t('The element must be empty. You entered %value.', [
'%value' => $value,
]));
}
}