diff --git a/course/format/classes/output/local/content/section/header.php b/course/format/classes/output/local/content/section/header.php index f4f3590656c..2781a4273e3 100644 --- a/course/format/classes/output/local/content/section/header.php +++ b/course/format/classes/output/local/content/section/header.php @@ -84,7 +84,7 @@ class header implements named_templatable, renderable { } else { if (is_null($format->get_sectionid()) || $format->get_sectionid() != $section->id) { // All sections are displayed. - if (!$data->editing) { + if (!$data->editing && $section->uservisible) { $data->title = $output->section_title($section, $course); } else { $data->title = $output->section_title_without_link($section, $course); diff --git a/course/format/classes/output/local/state/section.php b/course/format/classes/output/local/state/section.php index 96355dc401f..7c62baeaa13 100644 --- a/course/format/classes/output/local/state/section.php +++ b/course/format/classes/output/local/state/section.php @@ -83,7 +83,6 @@ class section implements renderable { 'rawtitle' => $section->name, 'cmlist' => [], 'visible' => !empty($section->visible), - 'sectionurl' => course_get_url($course, $section->section, ['navigation' => true])?->out(false), 'current' => $format->is_section_current($section), 'indexcollapsed' => $indexcollapsed, 'contentcollapsed' => $contentcollapsed, @@ -94,6 +93,10 @@ class section implements renderable { 'parentsectionid' => $section->get_component_instance()?->get_parent_section()?->id, ]; + if ($section->uservisible) { + $data->sectionurl = course_get_url($course, $section->section, ['navigation' => true])?->out(false); + } + if (empty($modinfo->sections[$section->section])) { return $data; }