diff --git a/mod/subsection/lang/en/subsection.php b/mod/subsection/lang/en/subsection.php index 422e15d2fc3..3893fbe662a 100644 --- a/mod/subsection/lang/en/subsection.php +++ b/mod/subsection/lang/en/subsection.php @@ -24,7 +24,6 @@ */ $string['modulename'] = 'Subsection'; -$string['modulename_help'] = 'Delegated subsections'; $string['modulenameplural'] = 'Subsections'; $string['pluginadministration'] = 'Subsection administration'; $string['pluginname'] = 'Subsection'; diff --git a/mod/subsection/lib.php b/mod/subsection/lib.php index 54be9187f3f..239a3a9963e 100644 --- a/mod/subsection/lib.php +++ b/mod/subsection/lib.php @@ -301,3 +301,22 @@ function mod_subsection_get_fontawesome_icon_map() { 'mod_subsection:subsection' => 'fa-rectangle-list', ]; } + +/** + * Get the course content items for the subsection module. + * + * This function is called when the course content is being generated for the activity chooser. + * However, here this module is never shown in the activity chooser so we return an empty array. + * + * @param \core_course\local\entity\content_item $contentitem + * @param stdClass $user + * @param stdClass $course + * @return array + */ +function mod_subsection_get_course_content_items( + core_course\local\entity\content_item $contentitem, + stdClass $user, + stdClass $course +): array { + return []; +} diff --git a/mod/subsection/tests/behat/subsection_limit.feature b/mod/subsection/tests/behat/subsection_limit.feature index a4b43168a22..f9c6579f124 100644 --- a/mod/subsection/tests/behat/subsection_limit.feature +++ b/mod/subsection/tests/behat/subsection_limit.feature @@ -17,16 +17,14 @@ Feature: Teacher can only add subsection when certain conditions are met | teacher1 | C1 | editingteacher | @javascript - Scenario: The activity chooser filter subsections when section limit is reached + Scenario: We cannot add subsections when maxsections is reached Given the following config values are set as admin: | maxsections | 10 | moodlecourse | And I log in as "teacher1" And I am on "Course 1" course homepage with editing mode on And I click on "Add content" "button" in the "Section 1" "section" - And I click on "Activity or resource" "button" in the ".dropdown-menu.show" "css_element" - And I should see "Subsection" in the "Add an activity or resource" "dialogue" + And I click on "Subsection" "link" in the ".dropdown-menu.show" "css_element" When the following config values are set as admin: | maxsections | 4 | moodlecourse | And I am on "Course 1" course homepage - Then I click on "Add an activity or resource" "button" in the "Section 1" "section" - And I should not see "Subsection" in the "Add an activity or resource" "dialogue" + And I should see "You have reached the maximum number of sections allowed for a course."