mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-81648 navigation: Add delegated section logic to section nodes
This commit is contained in:
parent
932b094134
commit
e3c36e48cc
@ -2295,10 +2295,20 @@ class global_navigation extends navigation_node {
|
||||
continue;
|
||||
}
|
||||
|
||||
$parentnode = $coursenode;
|
||||
|
||||
// Set the parent node to the parent section if this is a delegated section.
|
||||
if ($section->is_delegated()) {
|
||||
$parentsection = $section->get_component_instance()->get_parent_section();
|
||||
if ($parentsection) {
|
||||
$parentnode = $coursenode->find($parentsection->id, self::TYPE_SECTION) ?: $coursenode;
|
||||
}
|
||||
}
|
||||
|
||||
$sectionname = get_section_name($course, $section);
|
||||
$url = course_get_url($course, $section->section, array('navigation' => true));
|
||||
|
||||
$sectionnode = $coursenode->add($sectionname, $url, navigation_node::TYPE_SECTION,
|
||||
$sectionnode = $parentnode->add($sectionname, $url, navigation_node::TYPE_SECTION,
|
||||
null, $section->id, new pix_icon('i/section', ''));
|
||||
$sectionnode->nodetype = navigation_node::NODETYPE_BRANCH;
|
||||
$sectionnode->hidden = (!$section->visible || !$section->available);
|
||||
|
@ -68,6 +68,7 @@ class boostnavbar implements \renderable {
|
||||
}
|
||||
}
|
||||
if ($this->page->context->contextlevel == CONTEXT_COURSE) {
|
||||
$removesections = course_get_format($this->page->course)->can_sections_be_removed_from_navigation();
|
||||
// Remove any duplicate navbar nodes.
|
||||
$this->remove_duplicate_items();
|
||||
// Remove 'My courses' and 'Courses' if we are in the course context.
|
||||
|
Loading…
x
Reference in New Issue
Block a user