Skip to content

Commit

Permalink
MDL-82351 course: fix course_ajax_enabled function
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ferranrecio committed Oct 23, 2024
1 parent 9d0fe22 commit db8c8b1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion course/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit db8c8b1

Please sign in to comment.