function Quiz::getQuestions in Quiz 6.x
Same name and namespace in other branches
- 8.6 src/Entity/Quiz.php \Drupal\quiz\Entity\Quiz::getQuestions()
- 8.5 src/Entity/Quiz.php \Drupal\quiz\Entity\Quiz::getQuestions()
Retrieve list of published questions assigned to quiz.
This function should be used for question browsers and similar. It should not be used to decide what questions a user should answer when taking a quiz. Quiz::buildLayout is written for that purpose.
Return value
QuizQuestionRelationship[] An array of questions.
1 call to Quiz::getQuestions()
- Quiz::getNumberOfQuestions in src/
Entity/ Quiz.php - Finds out the number of configured questions for the quiz, taking into account random questions pulled from a pool
File
- src/
Entity/ Quiz.php, line 774
Class
- Quiz
- Defines the Quiz entity class.
Namespace
Drupal\quiz\EntityCode
function getQuestions() {
$relationships = Drupal::entityTypeManager()
->getStorage('quiz_question_relationship')
->loadByProperties([
'quiz_vid' => $this
->getRevisionId(),
]);
return $relationships;
}