Browse files

navigation MDL-22173 Fixed XHTML issue with navbar, and removed redun…

…dant ul's from nodes without children
  • Loading branch information...
1 parent 633fedb commit 6c721bbfedddef642009adbee770b6a1ac90e986 Sam Hemelryk committed Apr 27, 2010
Showing with 13 additions and 3 deletions.
  1. +6 −1 blocks/navigation/renderer.php
  2. +6 −1 blocks/settings/renderer.php
  3. +1 −1 lib/outputrenderers.php
View
7 blocks/navigation/renderer.php
@@ -96,7 +96,12 @@ protected function navigation_node($items, $attrs=array(), $expansionlimit=null,
$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 '';
+ }
}
}
View
7 blocks/settings/renderer.php
@@ -62,7 +62,12 @@ protected function navigation_node(navigation_node $node, $attrs=array()) {
$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) {
View
2 lib/outputrenderers.php
@@ -2079,7 +2079,7 @@ public function navbar() {
}
// 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) {

0 comments on commit 6c721bb

Please sign in to comment.