function QuizResultAnswer::getNext in Quiz 6.x
Same name and namespace in other branches
- 8.6 src/Entity/QuizResultAnswer.php \Drupal\quiz\Entity\QuizResultAnswer::getNext()
- 8.5 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 127
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];
}
}
}
}