private static function CourseOutlineForm::sortCourseOutline in Course 8.3
Same name and namespace in other branches
- 8.2 src/Form/CourseOutlineForm.php \Drupal\course\Form\CourseOutlineForm::sortCourseOutline()
- 3.x src/Form/CourseOutlineForm.php \Drupal\course\Form\CourseOutlineForm::sortCourseOutline()
Comparator function for course outline weights.
File
- src/
Form/ CourseOutlineForm.php, line 22
Class
Namespace
Drupal\course\FormCode
private static function sortCourseOutline($a, $b) {
if (is_object($a)) {
return $a
->getOption('weight') < $b
->getOption('weight') ? -1 : 1;
}
else {
return SortArray::sortByWeightElement($a, $b);
}
}