From f97256c180bab1b6e369e0fd0ec73319b5800496 Mon Sep 17 00:00:00 2001 From: Alexander Bias <alexander.bias@uni-ulm.de> Date: Thu, 28 Mar 2019 13:23:00 +0100 Subject: [PATCH] Prepare the plugin that the hooks for fetching the course news will be removed in Moodle 3.7. --- CHANGES.md | 1 + README.md | 2 +- locallib.php | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index d834a2a..710505b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2019-03-28 - Prepare the plugin that the hooks for fetching the course news will be removed in Moodle 3.7. If installed on Moodle 3.7, this plugin will silently disable the course news feature even if it is enabled in the plugin settings. * 2019-03-28 - Check compatibility for Moodle 3.6, no functionality change. * 2018-12-05 - Changed travis.yml due to upstream changes. diff --git a/README.md b/README.md index d893e28..04789f4 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ As described in the "Usage & Settings" section of this file, you should configur The course news feature displays course news from the activities within each of your courses. This is done by using the *_print_overview() hook which is implemented by most of Moodle core's and third party activity modules. -Please note that the *_print_overview() hook was deprecated in Moodle core when the MyOverview block was introduced. If you have enabled course news in block_course_overview_campus and if you have also enabled debugging with DEVELOPER level, you will see deprecation warnings whenever block_course_overview_campus calls a *_print_overview() function. For now, this does not mean that the course news feature is already broken. Moodle core will remove the *_print_overview() functions in Moodle 3.7. Third party developers might decide to remove the functions upfront from their activity modules. By then, we will either change the inner workings of the course news feature to a modern mechanism or we will remove the course news feature. +Please note that the *_print_overview() hook was deprecated in Moodle core when the MyOverview block was introduced. If you have enabled course news in block_course_overview_campus and if you have also enabled debugging with DEVELOPER level, you will see deprecation warnings whenever block_course_overview_campus calls a *_print_overview() function. For Moodle 3.6, this does not mean that the course news feature is already broken. However, Moodle core will remove the *_print_overview() functions in Moodle 3.7 (see MDL-57487). If installed on Moodle 3.7, this plugin will silently disable the course news feature even if it is enabled in the plugin settings. Block placement diff --git a/locallib.php b/locallib.php index b7fede9..d398735 100644 --- a/locallib.php +++ b/locallib.php @@ -184,8 +184,13 @@ function block_course_overview_campus_course_hidden_by_anyfilter($course) { * @return array html overview */ function block_course_overview_campus_get_overviews($courses, $skip) { + global $CFG; + $htmlarray = array(); - if ($modules = get_plugin_list_with_function('mod', 'print_overview')) { + + // The hooks for fetching the course news will be removed in Moodle 3.7 (see MDL-57487). + // So, we fetch course news only on Moodle 3.6. + if ((int)$CFG->branch < 37 && $modules = get_plugin_list_with_function('mod', 'print_overview')) { // Remove modules which should be skipped. $skipmodules = explode(',', $skip); if (is_array($skipmodules)) { -- GitLab