public function WebformSubmissionDevelGenerateTrait::validateForm in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/DevelGenerate/WebformSubmissionDevelGenerateTrait.php \Drupal\webform\Plugin\DevelGenerate\WebformSubmissionDevelGenerateTrait::validateForm()
Custom validation handler.
File
- src/
Plugin/ DevelGenerate/ WebformSubmissionDevelGenerateTrait.php, line 258
Class
- WebformSubmissionDevelGenerateTrait
- Provides a WebformSubmissionDevelGenerate trait.
Namespace
Drupal\webform\Plugin\DevelGenerateCode
public function validateForm(array $form, FormStateInterface $form_state) {
$webform_ids = array_filter($form_state
->getValue('webform_ids'));
// Let default webform validation handle requiring webform ids.
if (empty($webform_ids)) {
return;
}
$entity_type = $form_state
->getValue('entity-type');
$entity_id = $form_state
->getValue('entity-id');
if ($entity_type) {
if ($error = $this
->validateEntity($webform_ids, $entity_type, $entity_id)) {
$form_state
->setErrorByName('entity_type', $error);
}
}
}