function QuizQuestionsForm::getSubQuestions in Quiz 6.x
Same name and namespace in other branches
- 8.6 src/Form/QuizQuestionsForm.php \Drupal\quiz\Form\QuizQuestionsForm::getSubQuestions()
- 8.5 src/Form/QuizQuestionsForm.php \Drupal\quiz\Form\QuizQuestionsForm::getSubQuestions()
Return value
array of QuizQuestion
1 call to QuizQuestionsForm::getSubQuestions()
- QuizQuestionsForm::buildForm in src/
Form/ QuizQuestionsForm.php - Handles "manage questions" tab.
File
- src/
Form/ QuizQuestionsForm.php, line 179
Class
- QuizQuestionsForm
- Form to manage questions in a quiz.
Namespace
Drupal\quiz\FormCode
function getSubQuestions($root_question, $all_questions) {
$append = [];
foreach ($all_questions as $sub_question) {
if ($root_question
->id() == $sub_question
->get('qqr_pid')
->getString()) {
// Question is a leaf of this parent.
$append[$sub_question
->id()] = $sub_question;
}
}
return $append;
}