Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-84940

The section links block should not show subsections

XMLWordPrintable

    • 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:

      1. Set theme to classic and create a course in custom sections format with some topics
      2. Add some subsection to the general section
      3. Now add the section links block
      4. What should happen: the subsections are not included into the list.
      5. 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;
      }
      

            tusefomal Ferran Recio
            tusefomal Ferran Recio
            Carlos Escobedo Carlos Escobedo
            Laurent David Laurent David
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 9 minutes
                1h 9m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.