diff --git a/.upgradenotes/MDL-82351-2024102502242849.yml b/.upgradenotes/MDL-82351-2024102502242849.yml new file mode 100644 index 00000000000..831be97234f --- /dev/null +++ b/.upgradenotes/MDL-82351-2024102502242849.yml @@ -0,0 +1,7 @@ +issueNumber: MDL-82351 +notes: + core_course: + - message: >- + The course_format_ajax_support function is now deprecated. Use + course_get_format($course)->supports_ajax() instead. + type: deprecated diff --git a/course/lib.php b/course/lib.php index e526417dcb4..6f42157d4da 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-82351 + * @todo MDL-83417 Remove this function in Moodle 6.0 * @param string $format * @return stdClass */ +#[\core\attribute\deprecated(since: '5.0', mdl: 'MDL-82351')] 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; }