Merge branch 'primary_secondary_nav' of https://github.com/Chocolate-lightning/moodle

This commit is contained in:
Jun Pataleta
2021-08-25 10:42:57 +08:00
117 changed files with 3941 additions and 289 deletions
+28
View File
@@ -149,6 +149,10 @@ class navigation_node implements renderable {
public $requiresajaxloading = false;
/** @var bool If set to true this node will be added to the "flat" navigation */
public $showinflatnavigation = false;
/** @var bool If set to true this node will be forced into a "more" menu whenever possible */
public $forceintomoremenu = false;
/** @var bool If set to true this node will be displayed in the "secondary" navigation when applicable */
public $showinsecondarynavigation = true;
/**
* Constructs a new navigation_node
@@ -840,6 +844,30 @@ class navigation_node implements renderable {
return $this->action;
}
/**
* Sets whether the node and its children should be added into a "more" menu whenever possible.
*
* @param bool $forceintomoremenu
*/
public function set_force_into_more_menu(bool $forceintomoremenu = false) {
$this->forceintomoremenu = $forceintomoremenu;
foreach ($this->children as $child) {
$child->set_force_into_more_menu($forceintomoremenu);
}
}
/**
* Sets whether the node and its children should be displayed in the "secondary" navigation when applicable.
*
* @param bool $show
*/
public function set_show_in_secondary_navigation(bool $show = true) {
$this->showinsecondarynavigation = $show;
foreach ($this->children as $child) {
$child->set_show_in_secondary_navigation($show);
}
}
/**
* Add the menu item to handle locking and unlocking of a conext.
*