diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 2bfe56be4b3..04e2264f654 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -742,7 +742,7 @@ class moodle_core_renderer extends moodle_renderer_base { $COURSE = $this->page->course; // Required for legacy template uses - $navigation = $this->has_navbar(); + $navigation = $this->page->has_navbar(); ob_start(); include($templatefile); @@ -789,7 +789,7 @@ class moodle_core_renderer extends moodle_renderer_base { $course = $this->page->course; $performanceinfo = self::PERFORMANCE_INFO_TOKEN; - $navigation = $this->has_navbar(); + $navigation = $this->page->has_navbar(); if (!$menu && $navigation) { $menu = $loggedinas; } @@ -2373,15 +2373,7 @@ class moodle_core_renderer extends moodle_renderer_base { public function navbar() { return $this->page->navbar->content(); } - - /** - * Checks to see if there are any items on the navbar object - * @return bool true if there are, false if not - */ - public function has_navbar() { - return $this->page->navbar->has_items(); } -} /// RENDERERS diff --git a/lib/pagelib.php b/lib/pagelib.php index 4cba5a38e1d..a6316560449 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -475,6 +475,17 @@ class moodle_page { return $this->_navbar; } + /** + * Checks to see if there are any items on the navbar object + * @return bool true if there are, false if not + */ + public function has_navbar() { + if ($this->_navbar === null) { + $this->_navbar = new navbar($this); + } + return $this->_navbar->has_items(); + } + /** * Returns the settings navigation object * @return settings_navigation diff --git a/theme/standard/layout-popup.php b/theme/standard/layout-popup.php index 9089fcb32c0..8eaf1d9be3c 100644 --- a/theme/standard/layout-popup.php +++ b/theme/standard/layout-popup.php @@ -17,7 +17,7 @@ -has_navbar()) { // This is the navigation bar with breadcrumbs ?> +has_navbar()) { // This is the navigation bar with breadcrumbs ?> -has_navbar()) { // This is the navigation bar with breadcrumbs ?> +has_navbar()) { // This is the navigation bar with breadcrumbs ?> -has_navbar()) { // This is the navigation bar with breadcrumbs ?> +has_navbar()) { // This is the navigation bar with breadcrumbs ?>