From 6c721bbfedddef642009adbee770b6a1ac90e986 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Tue, 27 Apr 2010 02:01:38 +0000 Subject: [PATCH] navigation MDL-22173 Fixed XHTML issue with navbar, and removed redundant ul's from nodes without children --- blocks/navigation/renderer.php | 7 ++++++- blocks/settings/renderer.php | 7 ++++++- lib/outputrenderers.php | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/blocks/navigation/renderer.php b/blocks/navigation/renderer.php index d2162102900..0d8e7c62274 100644 --- a/blocks/navigation/renderer.php +++ b/blocks/navigation/renderer.php @@ -96,7 +96,12 @@ class block_navigation_renderer extends plugin_renderer_base { $content = html_writer::tag('li', $content, $liattr); $lis[] = $content; } - return html_writer::tag('ul', implode("\n", $lis), $attrs); + + if (count($lis)) { + return html_writer::tag('ul', implode("\n", $lis), $attrs); + } else { + return ''; + } } } \ No newline at end of file diff --git a/blocks/settings/renderer.php b/blocks/settings/renderer.php index bde5c53f224..761962542aa 100644 --- a/blocks/settings/renderer.php +++ b/blocks/settings/renderer.php @@ -62,7 +62,12 @@ class block_settings_renderer extends plugin_renderer_base { $content = html_writer::tag('li', $content, $liattr); $lis[] = $content; } - return html_writer::tag('ul', implode("\n", $lis), $attrs); + + if (count($lis)) { + return html_writer::tag('ul', implode("\n", $lis), $attrs); + } else { + return ''; + } } public function search_form(moodle_url $formtarget, $searchvalue) { diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 101d9f9ce37..7bbfe4bcd50 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -2079,7 +2079,7 @@ END; } // XHTML - return join(get_separator(), $htmlblocks); + return html_writer::tag('ul', join(html_writer::tag('li',get_separator()), $htmlblocks));; } protected function render_navigation_node(navigation_node $item) {