From db8c8b16028c0d380d5a93c217bfc7c26df5aec4 Mon Sep 17 00:00:00 2001 From: ferranrecio Date: Wed, 9 Oct 2024 13:41:15 +0200 Subject: [PATCH] MDL-82351 course: fix course_ajax_enabled function The course_ajax_enabled was using a course_format_ajax_support which does not inicialitze the course format with the correct parameters. Having a global function to get something the format base format can provide is unnecessary and redudant, for this reason the function is now deprecated. --- course/lib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/course/lib.php b/course/lib.php index e526417dcb43c..4b2f9208ef23c 100644 --- a/course/lib.php +++ b/course/lib.php @@ -1718,10 +1718,14 @@ function course_format_uses_sections($format) { * The returned object's property (boolean)capable indicates that * the course format supports Moodle course ajax features. * + * @deprecated since Moodle 5.0 MDL-83417 + * * @param string $format * @return stdClass */ +#[\core\attribute\deprecated(since: '5.0', mdl: 'MDL-83417', final: true)] function course_format_ajax_support($format) { + \core\deprecation::emit_deprecation_if_present(__FUNCTION__); $course = new stdClass(); $course->format = $format; return course_get_format($course)->supports_ajax(); @@ -2738,7 +2742,7 @@ function course_ajax_enabled($course) { // Check that the course format supports ajax functionality // The site 'format' doesn't have information on course format support if ($SITE->id !== $course->id) { - $courseformatajaxsupport = course_format_ajax_support($course->format); + $courseformatajaxsupport = course_get_format($course)->supports_ajax(); if (!$courseformatajaxsupport->capable) { return false; }