diff --git a/classes/output/courseformat/content.php b/classes/output/courseformat/content.php index 9a5594b2..07ca16af 100644 --- a/classes/output/courseformat/content.php +++ b/classes/output/courseformat/content.php @@ -89,11 +89,12 @@ public function export_for_template(\renderer_base $output) { $initialsection = ''; $course = $format->get_course(); $currentsectionid = 0; + $sectionzeroingrid = true; if (!empty($sections)) { // Is first entry section 0? if ($sections[0]->num === 0) { - if (!$singlesectionid) { + if ((!$singlesectionid) && (!$sectionzeroingrid)) { // Most formats uses section 0 as a separate section so we remove from the list. $initialsection = array_shift($sections); $data->initialsection = $initialsection; @@ -324,9 +325,13 @@ protected function get_grid_sections(\renderer_base $output, $settings): array { $sections = []; $numsections = $format->get_last_section_number(); $sectioninfos = $modinfo->get_section_info_all(); - // Get rid of section 0. - if (!empty($sectioninfos)) { - array_shift($sectioninfos); + + $sectionzeroingrid = true; + if (!$sectionzeroingrid) { + // Get rid of section 0. + if (!empty($sectioninfos)) { + array_shift($sectioninfos); + } } foreach ($sectioninfos as $thissection) { // The course/view.php check the section existence but the output can be called from other parts so we need to check it.