MDL-71680 navigation: Enable forcing navigation_node into "more" menu

- Part of: MDL-69588
Adds new property 'forceintomoremenu' and new setter method in the
navigation_node class to enable forcing a navigation note into a
"more" menu whenever possible.
This commit is contained in:
Mihail Geshoski 2021-06-03 15:34:34 +08:00 committed by Mathew May
parent f28535082c
commit 19fd786270

View File

@ -149,6 +149,8 @@ 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;
/**
* Constructs a new navigation_node
@ -840,6 +842,18 @@ 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->forceintomoremenu = $forceintomoremenu;
}
}
/**
* Add the menu item to handle locking and unlocking of a conext.
*