function Quiz::getNumberOfRequiredQuestions in Quiz 6.x
Same name and namespace in other branches
- 8.6 src/Entity/Quiz.php \Drupal\quiz\Entity\Quiz::getNumberOfRequiredQuestions()
- 8.5 src/Entity/Quiz.php \Drupal\quiz\Entity\Quiz::getNumberOfRequiredQuestions()
Get the number of required questions for a quiz.
Return value
int Number of required questions.
1 call to Quiz::getNumberOfRequiredQuestions()
- 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 681
Class
- Quiz
- Defines the Quiz entity class.
Namespace
Drupal\quiz\EntityCode
function getNumberOfRequiredQuestions() {
$query = Drupal::entityQuery('quiz_question_relationship');
$query
->condition('quiz_vid', $this
->getRevisionId());
$query
->condition('question_status', QuizQuestion::QUESTION_ALWAYS);
$result = $query
->execute();
return count($result);
}