Skip to content

Commit

Permalink
MDL-78063 format_weeks: Use sectionid instead of section
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikmillingpytlick committed Feb 2, 2024
1 parent 05d3cc1 commit 20a2bef
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions course/format/weeks/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function get_section_highlighted_name(): string {
/**
* The URL to use for the specified course (with section)
*
* @param int|stdClass $section Section object from database or just field course_sections.section
* @param int|stdClass|null $section Section object from database or just field course_sections.section
* if omitted the course view page is returned
* @param array $options options for view URL. At the moment core uses:
* 'navigation' (bool) if true and section has no separate page, the function returns null
Expand Down Expand Up @@ -148,7 +148,12 @@ public function get_view_url($section, $options = array()) {
$usercoursedisplay = $course->coursedisplay ?? COURSE_DISPLAY_SINGLEPAGE;
}
if ($sectionno != 0 && $usercoursedisplay == COURSE_DISPLAY_MULTIPAGE) {
$url->param('section', $sectionno);
if (is_object($section)) {
$sectionid = $section->id;
} else {
$sectionid = $this->get_section($sectionno)->id ?? null;
}
$url->param('sectionid', $sectionid);
} else {
if (empty($CFG->linkcoursesections) && !empty($options['navigation'])) {
return null;
Expand Down

0 comments on commit 20a2bef

Please sign in to comment.