You are here

private static function CourseOutlineForm::sortCourseOutline in Course 8.2

Same name and namespace in other branches
  1. 8.3 src/Form/CourseOutlineForm.php \Drupal\course\Form\CourseOutlineForm::sortCourseOutline()
  2. 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

CourseOutlineForm

Namespace

Drupal\course\Form

Code

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);
  }
}