You are here

function QuizQuestionController::numberToQuestionResultAnswer in Quiz 8.5

Same name and namespace in other branches
  1. 8.6 src/Controller/QuizQuestionController.php \Drupal\quiz\Controller\QuizQuestionController::numberToQuestionResultAnswer()
  2. 6.x src/Controller/QuizQuestionController.php \Drupal\quiz\Controller\QuizQuestionController::numberToQuestionResultAnswer()

Translate the numeric question index to a question result answer.

Parameters

Quiz $quiz:

int $question_number:

Return value

QuizResultAnswer

1 call to QuizQuestionController::numberToQuestionResultAnswer()
QuizQuestionController::checkEntityAccess in src/Controller/QuizQuestionController.php
Translate the numeric question index to a question result answer, and run the default entity access check on it.

File

src/Controller/QuizQuestionController.php, line 225

Class

QuizQuestionController

Namespace

Drupal\quiz\Controller

Code

function numberToQuestionResultAnswer($quiz, $question_number) {
  $quiz_result = QuizUtil::resultOrTemp($quiz);
  $qra = $quiz_result
    ->getLayout()[$question_number];
  return $qra;
}