public function QuizJumperForm::submitForm in Quiz 6.x
Same name and namespace in other branches
- 8.6 src/Form/QuizJumperForm.php \Drupal\quiz\Form\QuizJumperForm::submitForm()
- 8.5 src/Form/QuizJumperForm.php \Drupal\quiz\Form\QuizJumperForm::submitForm()
Form submission 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 FormInterface::submitForm
File
- src/
Form/ QuizJumperForm.php, line 35
Class
- QuizJumperForm
- Question jumper form.
Namespace
Drupal\quiz\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
/* @var $quiz_result QuizResult */
$quiz_result = $form_state
->getBuildInfo()['args'][0];
$quiz_result
->setQuestion($form_state
->getValue('question_number'));
$form_state
->setRedirect('quiz.question.take', [
'quiz' => $quiz_result
->getQuiz()
->id(),
'question_number' => $form_state
->getValue('question_number'),
]);
}