public function QuizSession::startQuiz in Quiz 6.x
Put a quiz result into the current user's session.
Parameters
QuizResult $quiz_result: The quiz result.
Overrides QuizSessionInterface::startQuiz
File
- src/
Services/ QuizSession.php, line 41
Class
- QuizSession
- Default implementation of the quiz session.
Namespace
Drupal\quiz\ServicesCode
public function startQuiz(QuizResult $quiz_result) {
$current_quizzes = $this
->getCurrentQuizzes();
$current_quizzes[$quiz_result
->getQuiz()
->id()][self::RESULT_ID] = $quiz_result
->id();
$current_quizzes[$quiz_result
->getQuiz()
->id()][self::CURRENT_QUESTION] = 1;
$this
->setCurrentQuizzes($current_quizzes);
}