function QuizQuestionsForm::sortQuestions in Quiz 8.5
Same name and namespace in other branches
- 8.6 src/Form/QuizQuestionsForm.php \Drupal\quiz\Form\QuizQuestionsForm::sortQuestions()
- 6.x src/Form/QuizQuestionsForm.php \Drupal\quiz\Form\QuizQuestionsForm::sortQuestions()
Entity type sorter for quiz questions.
File
- src/
Form/ QuizQuestionsForm.php, line 190
Class
- QuizQuestionsForm
- Form to manage questions in a quiz.
Namespace
Drupal\quiz\FormCode
function sortQuestions($a, $b) {
$aw = $a
->get('weight')
->getString();
$bw = $b
->get('weight')
->getString();
if ($aw == $bw) {
return 0;
}
return $aw < $bw ? -1 : 1;
}