mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-47434 format_weeks: section 0 navigation tweak
Section 0 is now only shown in the navigation block if it contains activities. If there are no activities then the section is removed. This mimicks the display on the course page.
This commit is contained in:
parent
c106341098
commit
f9745259b7
@ -148,6 +148,19 @@ class format_weeks extends format_base {
|
||||
}
|
||||
}
|
||||
parent::extend_course_navigation($navigation, $node);
|
||||
|
||||
// We want to remove the general section if it is empty.
|
||||
$modinfo = get_fast_modinfo($this->get_course());
|
||||
$sections = $modinfo->get_sections();
|
||||
if (!isset($sections[0])) {
|
||||
// The general section is empty to find the navigation node for it we need to get its ID.
|
||||
$section = $modinfo->get_section_info(0);
|
||||
$generalsection = $node->get($section->id, navigation_node::TYPE_SECTION);
|
||||
if ($generalsection) {
|
||||
// We found the node - now remove it.
|
||||
$generalsection->remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user