diff --git a/lib/navigationlib.php b/lib/navigationlib.php index de3f0bd75a5..da5dc7cb816 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -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. *