MDL-82574 mod_subsection: Remove module from activity chooser

* Fix behat tests to take into consideration the new add subsection
workflow
* modulename_help is only used in the activity chooser so has been
removed
This commit is contained in:
Laurent David 2024-08-20 09:56:27 +02:00
parent 74cfbbacc6
commit ca55b62b43
3 changed files with 22 additions and 6 deletions

View File

@ -24,7 +24,6 @@
*/
$string['modulename'] = 'Subsection';
$string['modulename_help'] = 'Delegated subsections';
$string['modulenameplural'] = 'Subsections';
$string['pluginadministration'] = 'Subsection administration';
$string['pluginname'] = 'Subsection';

View File

@ -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 [];
}

View File

@ -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."