mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-69588 navigation: Enable setting node visibility in secondary nav
Adds new property 'showinsecondarynavigation' and a new setter method in the navigation_node class to enable setting the visibility of the node in the secondary navigation.
This commit is contained in:
parent
ee63214306
commit
bddc64a39d
@ -151,6 +151,8 @@ class navigation_node implements renderable {
|
||||
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
|
||||
@ -854,6 +856,18 @@ class navigation_node implements renderable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user