diff --git a/lib/navigationlib.php b/lib/navigationlib.php
index 54cbe6afb6d..6140cf90d65 100644
--- a/lib/navigationlib.php
+++ b/lib/navigationlib.php
@@ -444,11 +444,13 @@ class navigation_node implements renderable {
/**
* Walk the tree building up a list of all the flat navigation nodes.
*
+ * @deprecated since Moodle 4.0
* @param flat_navigation $nodes List of the found flat navigation nodes.
* @param boolean $showdivider Show a divider before the first node.
* @param string $label A label for the collection of navigation links.
*/
public function build_flat_navigation_list(flat_navigation $nodes, $showdivider = false, $label = '') {
+ debugging("Function has been deprecated with the deprecation of the flat_navigation class.");
if ($this->showinflatnavigation) {
$indent = 0;
if ($this->type == self::TYPE_COURSE || $this->key === self::COURSE_INDEX_PAGE) {
@@ -3981,6 +3983,7 @@ class breadcrumb_navigation_node extends navigation_node {
* Subclass of navigation_node allowing different rendering for the flat navigation
* in particular allowing dividers and indents.
*
+ * @deprecated since Moodle 4.0 - do not use any more. Leverage secondary/tertiary navigation concepts
* @package core
* @category navigation
* @copyright 2016 Damyon Wiese
@@ -4003,6 +4006,7 @@ class flat_navigation_node extends navigation_node {
* @param mixed $navnode A navigation_node or an array
*/
public function __construct($navnode, $indent) {
+ debugging("Flat nav has been deprecated in favour of primary/secondary navigation concepts");
if (is_array($navnode)) {
parent::__construct($navnode);
} else if ($navnode instanceof navigation_node) {
@@ -4114,6 +4118,7 @@ class flat_navigation_node extends navigation_node {
* Class used to generate a collection of navigation nodes most closely related
* to the current page.
*
+ * @deprecated since Moodle 4.0 - do not use any more. Leverage secondary/tertiary navigation concepts
* @package core
* @copyright 2016 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -4131,6 +4136,7 @@ class flat_navigation extends navigation_node_collection {
if (during_initial_install()) {
return false;
}
+ debugging("Flat navigation has been deprecated in favour of primary/secondary navigation concepts");
$this->page = $page;
}
@@ -4208,6 +4214,24 @@ class flat_navigation extends navigation_node_collection {
$flat->icon = new pix_icon('t/preferences', '');
$this->add($flat);
}
+
+ // Add-a-block in editing mode.
+ if (isset($this->page->theme->addblockposition) &&
+ $this->page->theme->addblockposition == BLOCK_ADDBLOCK_POSITION_FLATNAV &&
+ $PAGE->user_is_editing() && $PAGE->user_can_edit_blocks()) {
+ $url = new moodle_url($PAGE->url, ['bui_addblock' => '', 'sesskey' => sesskey()]);
+ $addablock = navigation_node::create(get_string('addblock'), $url);
+ $flat = new flat_navigation_node($addablock, 0);
+ $flat->set_showdivider(true, get_string('blocksaddedit'));
+ $flat->key = 'addblock';
+ $flat->icon = new pix_icon('i/addblock', '');
+ $this->add($flat);
+
+ $addblockurl = "?{$url->get_query_string(false)}";
+
+ $PAGE->requires->js_call_amd('core/addblockmodal', 'init',
+ [$PAGE->pagetype, $PAGE->pagelayout, $addblockurl]);
+ }
}
/**
diff --git a/lib/upgrade.txt b/lib/upgrade.txt
index 0732a328237..1f75d9339e1 100644
--- a/lib/upgrade.txt
+++ b/lib/upgrade.txt
@@ -297,6 +297,7 @@ defined or can't be applied.
* Default blocks for dashboard has been updated. The page will now have the following in the corresponding region:
* Calendar, Timeline - Center
* Recently accessed courses - Side bar/blocks drawer
+* Flat navigation classes have been marked for deprecation with the introduction of primary and secondary navigation concepts.
=== 3.11.4 ===
* A new option dontforcesvgdownload has been added to the $options parameter of the send_file() function.
diff --git a/theme/boost/layout/columns2.php b/theme/boost/layout/columns2.php
index 3b45506d450..3c35b1ad345 100644
--- a/theme/boost/layout/columns2.php
+++ b/theme/boost/layout/columns2.php
@@ -74,6 +74,5 @@ $templatecontext = [
'overflow' => $overflow,
'addblockbutton' => $addblockbutton,
];
-$nav = $PAGE->flatnav;
-$templatecontext['firstcollectionlabel'] = $nav->get_collectionlabel();
+
echo $OUTPUT->render_from_template('theme_boost/columns2', $templatecontext);
diff --git a/theme/boost/layout/drawers.php b/theme/boost/layout/drawers.php
index 2325ae0106d..dcea9528c1e 100644
--- a/theme/boost/layout/drawers.php
+++ b/theme/boost/layout/drawers.php
@@ -108,7 +108,4 @@ $templatecontext = [
'addblockbutton' => $addblockbutton
];
-$nav = $PAGE->flatnav;
-$templatecontext['firstcollectionlabel'] = $nav->get_collectionlabel();
-
echo $OUTPUT->render_from_template('theme_boost/drawers', $templatecontext);
diff --git a/theme/boost/templates/flat_navigation.mustache b/theme/boost/templates/flat_navigation.mustache
index e6fef272ec3..c6424ba612a 100644
--- a/theme/boost/templates/flat_navigation.mustache
+++ b/theme/boost/templates/flat_navigation.mustache
@@ -15,6 +15,7 @@
along with Moodle. If not, see