diff --git a/course/classes/local/service/content_item_service.php b/course/classes/local/service/content_item_service.php index a3cf2f4d1a2..f5e00ee47dd 100644 --- a/course/classes/local/service/content_item_service.php +++ b/course/classes/local/service/content_item_service.php @@ -224,11 +224,8 @@ class content_item_service { $exported = $ciexporter->export($PAGE->get_renderer('core')); // Sort by title for return. - usort($exported->content_items, function($a, $b) { - return strcmp($a->title, $b->title); - }); - - return $exported->content_items; + \core_collator::asort_objects_by_property($exported->content_items, 'title'); + return array_values($exported->content_items); } /** @@ -300,11 +297,9 @@ class content_item_service { $exported = $ciexporter->export($PAGE->get_renderer('course')); // Sort by title for return. - usort($exported->content_items, function($a, $b) { - return strcmp($a->title, $b->title); - }); + \core_collator::asort_objects_by_property($exported->content_items, 'title'); - return $exported->content_items; + return array_values($exported->content_items); } /**