Form/QuizTakeForm error in validateForm

Created on 20 September 2024, 3 months ago

The validateForm function for Form/QuizTakeForm uses getCurrentQuestionNumber when it should (I think) be using getCurrentQuestion.

Line 281

Probably missed because it only matters when allowSkipping is false.
Also the assignment of $current_question should probably be inside the test as its not used in the function unless allowSkipping is false.

public function validateForm(array &$form, FormStateInterface $form_state) {
    $quiz = $this->getQuiz();
    if ($quiz instanceof QuizInterface) {
      /** @var \Drupal\quiz_maker\QuestionInterface $current_question */
      $current_question = $this->quizSession->getCurrentQuestionNumber($quiz);
      if (!$quiz->allowSkipping()) {
        $current_question->validateAnsweringForm($form, $form_state);
      }
    }
  }
πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom arcaic Milton Keynes

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024