Skip to content

Instantly share code, notes, and snippets.

@samhemelryk
Created November 21, 2013 20:22
Show Gist options
  • Save samhemelryk/7588922 to your computer and use it in GitHub Desktop.
Save samhemelryk/7588922 to your computer and use it in GitHub Desktop.
Force the courses branch in the navigation to populate itself and to always be shown expanded.
diff --git a/lib/navigationlib.php b/lib/navigationlib.php
index d1c873f..452d956 100644
--- a/lib/navigationlib.php
+++ b/lib/navigationlib.php
@@ -1137,6 +1137,12 @@ class global_navigation extends navigation_node {
$canviewcourseprofile = true;
+ // Tell the navigation to always load all courses.
+ // Default behaviour is load the courses by AJAX, we want them there from word go.
+ $this->load_all_courses();
+ // And expand the courses branch by default.
+ $this->rootnodes['courses']->force_open();
+
// Next load context specific content into the navigation
switch ($this->page->context->contextlevel) {
case CONTEXT_SYSTEM :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment