public function QuizQuestionAnsweringForm::validateForm in Quiz 6.x
Same name and namespace in other branches
- 8.6 src/Form/QuizQuestionAnsweringForm.php \Drupal\quiz\Form\QuizQuestionAnsweringForm::validateForm()
- 8.5 src/Form/QuizQuestionAnsweringForm.php \Drupal\quiz\Form\QuizQuestionAnsweringForm::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/ QuizQuestionAnsweringForm.php, line 396
Class
- QuizQuestionAnsweringForm
- The form used to deliver questions to users and capture their responses.
Namespace
Drupal\quiz\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$quiz_result = $form_state
->getBuildInfo()['args'][1];
$time_reached = $quiz_result
->isTimeReached();
if ($time_reached) {
// Let's not validate anything, because the input won't get saved in submit
// either.
return;
}
}