Skip to content

Commit 5d7431c

Browse files
committed
Fix the case of displaying the section 0
While standard course format do not support it, it is possible to see the course with a parameter like ?section=0. Previously, this led to both the course page and section 0 highlighted. Credit goes to @5882wolverine for spotting this. Fix bug #24
1 parent d10bd37 commit 5d7431c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

block_course_contents.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public function get_content() {
190190
if (($i == 0) && ($displaycourselink)) {
191191
$sectionclass = 'section-item';
192192

193-
if (empty($selected)) {
193+
if ($selected === null) {
194194
$sectionclass .= ' selected';
195195
}
196196
$text .= html_writer::start_tag('li', array('class' => $sectionclass));
@@ -204,7 +204,7 @@ public function get_content() {
204204
$anchortext = $course->shortname;
205205
}
206206

207-
if (empty($selected)) {
207+
if ($selected === null) {
208208
$text .= ' '.$anchortext;
209209
} else {
210210
$text .= ' '.html_writer::link(course_get_url($course), $anchortext);

0 commit comments

Comments
 (0)