public function ImportCourseForm::validateForm in Opigno module 8
Same name and namespace in other branches
- 3.x src/Form/ImportCourseForm.php \Drupal\opigno_module\Form\ImportCourseForm::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/ ImportCourseForm.php, line 60
Class
- ImportCourseForm
- Import Course form.
Namespace
Drupal\opigno_module\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
// Validation is optional.
if (empty($_FILES['files']['name']['course_opi'])) {
// Only need to validate if the field actually has a file.
$form_state
->setError($form['course_opi'], $this
->t("The file was not uploaded."));
}
}