Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Boost Navigation: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
Line 3: Line 3:


== Flat navigation ==
== Flat navigation ==
This is a new navigation element that is available at $PAGE->flatnav (magic getter). You can loop over the nodes and render them in any way you like - each node is an instance of the flat_navigation_node defined in lib/navigationlib.php.


The flat navigation is built as the same time as the full navigation tree so it does not use any additonal DB queries. Certain nodes have been "picked" for inclusion in the flat navigation (but please keep it very short or we will have to re-invent it again).  
The flat navigation is built as the same time as the full navigation tree so it does not use any additonal DB queries. Certain nodes have been "picked" for inclusion in the flat navigation (but please keep it very short or we will have to re-invent it again).  
This is a new navigation element that is available at $PAGE->flatnav (magic getter). You can loop over the nodes and render them in any way you like - each node is an instance of the flat_navigation_node defined in lib/navigationlib.php.


To mark a node from the navigation tree as one that should also be in the flat navigation - set the 'showinflatnavigation' property on the node to true.  
To mark a node from the navigation tree as one that should also be in the flat navigation - set the 'showinflatnavigation' property on the node to true.  
Line 14: Line 15:


== Settings cogs ==
== Settings cogs ==
These navigation elements are custom elements that only exist in the boost theme. The boost theme has it's own core renderer which is where they are defined. See theme/boost/classes/output/core_renderer.php. The functions are region_main_settings_menu() and context_header_settings_menu(). These functions will (only on certain pages) add all the nodes from the settings nav tree into a flat menu. Only leaves from the settings tree are added to the menu, branches and leaves are shown on the page linked to by the "More.." menu item at the end of the list.
 
These navigation elements are custom elements that only exist in the boost theme. The boost theme has it's own core renderer which is where they are defined. See theme/boost/classes/output/core_renderer.php. The functions are region_main_settings_menu() and context_header_settings_menu().
 
These functions will (only on certain pages) add all the nodes from the settings nav tree into a flat menu. Only leaves from the settings tree are added to the menu, branches and leaves are shown on the page linked to by the "More.." menu item at the end of the list.
 
The "only on certain pages" mentioned above means ... TODO

Revision as of 10:37, 2 December 2016

The Boost theme for Moodle 3.2 includes several new navigation elements than can use used by other themes.

Flat navigation

The flat navigation is built as the same time as the full navigation tree so it does not use any additonal DB queries. Certain nodes have been "picked" for inclusion in the flat navigation (but please keep it very short or we will have to re-invent it again).

This is a new navigation element that is available at $PAGE->flatnav (magic getter). You can loop over the nodes and render them in any way you like - each node is an instance of the flat_navigation_node defined in lib/navigationlib.php.

To mark a node from the navigation tree as one that should also be in the flat navigation - set the 'showinflatnavigation' property on the node to true.

$coursenode->showinflatnavigation = true;

Settings cogs

These navigation elements are custom elements that only exist in the boost theme. The boost theme has it's own core renderer which is where they are defined. See theme/boost/classes/output/core_renderer.php. The functions are region_main_settings_menu() and context_header_settings_menu().

These functions will (only on certain pages) add all the nodes from the settings nav tree into a flat menu. Only leaves from the settings tree are added to the menu, branches and leaves are shown on the page linked to by the "More.." menu item at the end of the list.

The "only on certain pages" mentioned above means ... TODO