diff --git a/lib.php b/lib.php index 4a225da..ed20cf3 100644 --- a/lib.php +++ b/lib.php @@ -390,13 +390,17 @@ public function get_view_url($section, $options = []) { } else { $sectionno = $section; } - if ((!empty($options['navigation']) || array_key_exists('sr', $options)) && $sectionno !== null) { + if ((!empty($options['navigation'])) && $sectionno !== null) { // Display section on separate page. $sectioninfo = $this->get_section($sectionno); return new moodle_url('/course/section.php', ['id' => $sectioninfo->id]); } if ($this->uses_sections() && $sectionno !== null) { - $url->set_anchor('section-'.$sectionno); + if ($this->coursedisplay == COURSE_DISPLAY_MULTIPAGE) { + $url->param('section', $sectionno); + } else { + $url->set_anchor('section-'.$sectionno); + } } return $url; diff --git a/tests/privacy_provider_test.php b/tests/privacy_provider_test.php index 90fa010..65a399f 100644 --- a/tests/privacy_provider_test.php +++ b/tests/privacy_provider_test.php @@ -65,7 +65,7 @@ protected static function set_property($obj, $name, $value): void { * @param stdClass $obj The object. * @param string $name Name of the method. */ - protected static function get_property($obj, $name): ReflectionClass { + protected static function get_property($obj, $name): \ReflectionClass { // Ref: http://stackoverflow.com/questions/18558183/phpunit-mockbuilder-set-mock-object-internal-property ish. $class = new \ReflectionClass($obj); $property = $class->getProperty($name);