From a4397489c1885967cbee4dbc607aa6e72fadefce Mon Sep 17 00:00:00 2001 From: samhemelryk Date: Tue, 1 Sep 2009 04:13:00 +0000 Subject: [PATCH] navigation MDL-14632 Fixed bug with deprecated build_navigation function --- lib/deprecatedlib.php | 6 +++++- lib/navigationlib.php | 12 +++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index e17ce7180c..e7d2d71ab1 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -3635,7 +3635,11 @@ function build_navigation($extranavlinks, $cm = null) { # debugging('build_navigation() has been deprecated, please replace with $PAGE->navbar methods', DEBUG_DEVELOPER); foreach ($extranavlinks as $nav) { if (array_key_exists('name', $nav)) { - $link = (array_key_exists('link', $nav))?$nav['link']:null; + if (array_key_exists('link', $nav) && !empty($nav['link'])) { + $link = $nav['link']; + } else { + $link = null; + } $PAGE->navbar->add($nav['name'],null, null, navbar::TYPE_CUSTOM, $link); } } diff --git a/lib/navigationlib.php b/lib/navigationlib.php index fc38ec42ad..b6d2a1b107 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -1852,23 +1852,20 @@ class navbar extends navigation_node { // For screen readers $output = get_accesshide(get_string('youarehere','access'), 'h2')."\n"; $this->content = $output; @@ -1958,7 +1955,8 @@ class navbar extends navigation_node { $this->keys[] = $key; $child = $this->get_by_path($this->keys); if ($child!==false) { - $child->forceopen = true; + // This ensure that the child will be shown + $child->make_active(); } return $key; } -- 2.39.5