From 3e49f34657c5af8d383e0baebcbce1746f386916 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Thu, 29 Jan 2026 12:09:43 +0100 Subject: [PATCH] MDL-87761 course: Add warning for phasing out subsection descriptions The Description field within the Subsection edit form has been deprecated since Moodle 5.2 onwards (see MDL-87279). To ensure a smooth transition and avoid data loss for our users, the XD team have prepared a solution to notify them of this upcoming change in stable versions. --- public/course/editsection_form.php | 13 ++++++++++++- public/lang/en/course.php | 1 + .../tests/behat/subsection_actionmenu.feature | 5 +++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/public/course/editsection_form.php b/public/course/editsection_form.php index 5263b02cc53..dd4031f4807 100644 --- a/public/course/editsection_form.php +++ b/public/course/editsection_form.php @@ -39,7 +39,18 @@ class editsection_form extends moodleform { $mform->setDefault('name', $sectioninfo->name); $mform->addRule('name', get_string('maximumchars', '', 1333), 'maxlength', 1333, 'client'); - /// Prepare course and the editor + // Prepare course and the editor. + + if ($sectioninfo->is_delegated()) { + // Show a warning that subsection descriptions will be discontinued. + $warning = $OUTPUT->notification( + message: get_string('subsectiondescriptionwarning', 'course'), + type: \core\output\notification::NOTIFY_WARNING, + closebutton: false, + titleicon: 'i/circleinfo', + ); + $mform->addElement('static', 'subsectionwarning', '', $warning); + } $mform->addElement('editor', 'summary_editor', get_string('description'), null, $this->_customdata['editoroptions']); $mform->setType('summary_editor', PARAM_RAW); diff --git a/public/lang/en/course.php b/public/lang/en/course.php index a86319338b3..c6c32124742 100644 --- a/public/lang/en/course.php +++ b/public/lang/en/course.php @@ -153,6 +153,7 @@ $string['searchresults'] = 'Search results: {$a}'; $string['sectionlink'] = 'Permalink'; $string['showstartedcoursestask'] = 'Show courses on start date'; $string['submitsearch'] = 'Submit search'; +$string['subsectiondescriptionwarning'] = 'Subsection descriptions will be discontinued in Moodle 5.2. To add a description, use a Text and media area instead.'; $string['supports'] = 'This activity supports'; $string['studentsatriskincourse'] = 'Students at risk in {$a} course'; $string['studentsatriskinfomessage'] = 'Hi {$a->userfirstname}, diff --git a/public/mod/subsection/tests/behat/subsection_actionmenu.feature b/public/mod/subsection/tests/behat/subsection_actionmenu.feature index 867301e77ae..ef0ac99062c 100644 --- a/public/mod/subsection/tests/behat/subsection_actionmenu.feature +++ b/public/mod/subsection/tests/behat/subsection_actionmenu.feature @@ -103,12 +103,17 @@ Feature: The module menu replaces the delegated section menu And I click on "Edit" "button" in the "[data-region='header-actions-container']" "css_element" And I choose "Edit settings" in the open action menu And the field "Section name" matches value "Subsection1" + And I should see "Subsection descriptions will be discontinued in Moodle 5.2" And I click on "Cancel" "button" And I am on the "C1 > Section 1" "course > section" page # Section page. Open Subsection1 module action menu. And I open "Subsection1" actions menu And I choose "Edit settings" in the open action menu And the field "Section name" matches value "Subsection1" + # But subsection description warning is not shown in section edit form. + And I am on "Course 1" course homepage + And I edit the section "0" + And I should not see "Subsection descriptions will be discontinued in Moodle 5.2" @javascript Scenario: Permalink option in subsection action menu