Skip to content

Commit

Permalink
navigation MDL-22173 Fixed XHTML issue with navbar, and removed redun…
Browse files Browse the repository at this point in the history
…dant ul's from nodes without children
  • Loading branch information
Sam Hemelryk committed Apr 27, 2010
1 parent 633fedb commit 6c721bb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion blocks/navigation/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
}
}

}
7 changes: 6 additions & 1 deletion blocks/settings/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion lib/outputrenderers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6c721bb

Please sign in to comment.