-
Bug
-
Resolution: Fixed
-
Minor
-
4.5, 5.0
-
1
-
HQ 2025 Sprint I1.3 Moppies
The implementation of the sections links block is quite old and list the subsections as if they are normal sections.
Steps to reproduce:
- Set theme to classic and create a course in custom sections format with some topics
- Add some subsection to the general section
- Now add the section links block
- What should happen: the subsections are not included into the list.
- What happens: the subsections are listed after the regular sections as if they are sections.
It is unclear whether the block will continue to exist when the classic theme is removed in Moodle 6.0, so investing a lot of time in it does not seem necessary.
The best approach is to filter from the list any delegated sections.
Technical shaping
Technically, a subsection is normal but belongs to a delegate component (mod_subsection in the case of a subsection).
It is relatively easy to filter all delegated sections because the section_info object has a method called get_component_instance that returns null for non-delegated sections. By adding an if clause into the for loop, the subsections will be filtered:
if ($section->get_component_instance() !== null) { |
continue; |
}
|