From 12cc75aed58e37feef70d31e6be1603733c51c1b Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Tue, 11 May 2010 07:30:04 +0000 Subject: [PATCH] custommenu MDL-22398 Fixed notice during install/upgrade with $CFG->custommenuitems --- lib/outputcomponents.php | 4 +++- lib/outputrenderers.php | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index c45f70d6d1e..d1ec56078be 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -2099,7 +2099,9 @@ class custom_menu extends custom_menu_item { public function __construct($text='base') { global $CFG; parent::__construct($text); - $this->override_children(self::convert_text_to_menu_nodes($CFG->custommenuitems)); + if (!empty($CFG->custommenuitems)) { + $this->override_children(self::convert_text_to_menu_nodes($CFG->custommenuitems)); + } } /** diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index f3ca2f82465..71e0782bbdf 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -2191,6 +2191,10 @@ END; * @return string */ public function custom_menu() { + global $CFG; + if (empty($CFG->custommenuitems)) { + return ''; + } $custommenu = new custom_menu(); return $this->render_custom_menu($custommenu); }