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

Section 0 displays default name when user intends to be blank in one section per page mode.

    XMLWordPrintable

Details

    • MOODLE_23_STABLE
    • Hide

      None.

      Show
      None.
    • Hide
      1. Create a course say in the 'Topics' format.
      2. Set to 'One section per page' in the course settings.
      3. Click on a topic so that it and section zero are displayed.
      4. Turn on editing.
      5. Edit section zero's summary.
      6. Un-tick 'Use default section name'.
      7. Leave the section name blank.
      8. Save and go back to the course to observe that no section title is displayed.
      9. Go back to editing section zero's summary and enter a word.
      10. Save and then observe that the word you have entered is displayed.
      Show
      Create a course say in the 'Topics' format. Set to 'One section per page' in the course settings. Click on a topic so that it and section zero are displayed. Turn on editing. Edit section zero's summary. Un-tick 'Use default section name'. Leave the section name blank. Save and go back to the course to observe that no section title is displayed. Go back to editing section zero's summary and enter a word. Save and then observe that the word you have entered is displayed.

    Description

      When a course is set in 'One section per page' mode and the user un-ticks 'Use default section name' for section zero and leaves it intentionally blank the default name is still displayed.

      This is demonstrated by 'bad' - s0_b.png and 'good' s0_g.png.

      The fault lies in '/course/format/renderer.php', where:

      $hasnamesecpg = ($onsectionpage && ($section->section == 0 && !is_null($section->name)));

      should be:

      $hasnamesecpg = ($onsectionpage && ($section->section == 0 && (string)$section->name !== ''));

      Replication steps:

      1. Create a course say in the 'Topics' format.
      2. Set to 'One section per page' in the course settings.
      3. Click on a topic so that it and section zero are displayed.
      4. Turn on editing.
      5. Edit section zero's summary.
      6. Un-tick 'Use default section name'.
      7. Leave the section name blank.
      8. Save and go back to the course to observe that the default word 'General' is displayed.

      Attachments

        1. s0_b.png
          s0_b.png
          43 kB
        2. s0_g.png
          s0_g.png
          42 kB

        Issue Links

          Activity

            People

              Unassigned Unassigned
              gb2048 Gareth J Barnard
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: