Skip to content

Commit 0bf3cf1

Browse files
committed
Overwrite subsection menu (MDL-82510)
1 parent ae3aa00 commit 0bf3cf1

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
// This file is part of Moodle - http://moodle.org/
3+
//
4+
// Moodle is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// Moodle is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
17+
namespace format_multitopic\output\courseformat\content\cm;
18+
19+
use core\output\action_menu\link;
20+
use core_courseformat\output\local\content\cm\delegatedcontrolmenu as delegatedcontrolmenu_base;
21+
22+
/**
23+
* Class to render delegated section controls.
24+
*
25+
* @package core_courseformat
26+
* @copyright 2025 James Calder and Otago Polytechnic
27+
* @copyright based on work by 2024 Amaia Anabitarte <[email protected]>
28+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29+
*/
30+
class delegatedcontrolmenu extends delegatedcontrolmenu_base {
31+
32+
/**
33+
* Retrieves the view item for the section control menu.
34+
*
35+
* @return link|null The menu item if applicable, otherwise null.
36+
*/
37+
protected function get_section_view_item(): ?link {
38+
return null;
39+
}
40+
41+
/**
42+
* Retrieves the permalink item for the section control menu.
43+
*
44+
* @return link|null The menu item if applicable, otherwise null.
45+
*/
46+
protected function get_section_permalink_item(): ?link {
47+
$link = parent::get_section_permalink_item();
48+
49+
if ($link) {
50+
$link->url = course_get_url($this->format->get_course(), $this->section);
51+
}
52+
53+
return $link;
54+
}
55+
56+
}

0 commit comments

Comments
 (0)