function QuizResultAnswer::getNext in Quiz 8.6
Same name and namespace in other branches
- 8.5 src/Entity/QuizResultAnswer.php \Drupal\quiz\Entity\QuizResultAnswer::getNext()
- 6.x src/Entity/QuizResultAnswer.php \Drupal\quiz\Entity\QuizResultAnswer::getNext()
Get the next question.
Return value
QuizResultAnswer The next question in the layout or NULL.
File
- src/
Entity/ QuizResultAnswer.php, line 124
Class
- QuizResultAnswer
- Defines the Quiz entity class.
Namespace
Drupal\quiz\EntityCode
function getNext() {
$result = $this
->get('result_id')
->referencedEntities()[0];
foreach ($result
->getLayout() as $idx => $qra) {
if ($qra == $this) {
if (isset($result
->getLayout()[$idx + 1])) {
return $result
->getLayout()[$idx + 1];
}
}
}
}