public function AnimateEditForm::validateForm in Animate Any 8
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/ AnimateEditForm.php, line 107
Class
- AnimateEditForm
- Provides a edit form for edit/update the animation data from Animation list.
Namespace
Drupal\animate_any\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$op = (string) $form_state
->getValue('op');
if ($op == $this
->t('Update Settings')) {
$parent = $form_state
->getValue('parent_class');
if (empty($parent)) {
$form_state
->setErrorByName("parent_class", $this
->t("Please select parent class"));
}
foreach ($form_state
->getValue('animate_fieldset') as $key => $value) {
if (empty($value['section_identity'])) {
$form_state
->setErrorByName("animate_fieldset][{$key}][section_identity", $this
->t("Please select section identity for row @key", [
'@key' => $key,
]));
}
if ($value['section_event'] == 'none') {
$form_state
->setRebuild();
$form_state
->setErrorByName("animate_fieldset][{$key}][section_event", $this
->t("Please select section event for row @key", [
'@key' => $key,
]));
}
if ($value['section_animation'] == 'none') {
$form_state
->setErrorByName("animate_fieldset][{$key}][section_animation", $this
->t("Please select section animation for row @key", [
'@key' => $key,
]));
}
}
}
}