public function OpignoActivityForm::validateForm in Opigno module 8
Same name and namespace in other branches
- 3.x src/Form/OpignoActivityForm.php \Drupal\opigno_module\Form\OpignoActivityForm::validateForm()
Button-level validation handlers are highly discouraged for entity forms, as they will prevent entity validation from running. If the entity is going to be saved during the form submission, this method should be manually invoked from the button-level validation handler, otherwise an exception will be thrown.
Overrides ContentEntityForm::validateForm
File
- src/
Form/ OpignoActivityForm.php, line 293
Class
- OpignoActivityForm
- Form controller for Activity edit forms.
Namespace
Drupal\opigno_module\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
$moduleHandler = \Drupal::service('module_handler');
$values = $form_state
->getValues();
if ($moduleHandler
->moduleExists('opigno_skills_system') && isset($values['manual_skill_management']) && $values['manual_skill_management'] == FALSE) {
unset($values['skills_list'][0]);
unset($values['skill_level'][0]);
$form_state
->setValues($values);
}
}