The Boost theme for Moodle 3.2 includes several new navigation elements than can use used by other themes.
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;
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