Closed (fixed)
Project:
Nice Menus
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Oct 2006 at 19:39 UTC
Updated:
17 May 2007 at 19:02 UTC
Hi!
When validating my website, I noticed that menu items whose path contained a single quote had invalid class names, for example 'menu-path-viewname-What's New'; it's fixable by changing the two lines where this is generated to use backslash-escaped double quote so the above example would become "menu-path-viewname-What's New" which is a correctly terminated string. Changed code is shown below :-
function _nice_menu_tree($pid = 1) {
$menu = menu_get_menu();
$output['content'] = '';
$output['subject'] = $menu['items'][$pid]['title'];
if ($menu['visible'][$pid]['children']) {
foreach ($menu['visible'][$pid]['children'] as $mid) {
// Build class name based on menu path e.g. to give each menu item individual style
$path_class = 'menu-path-'. str_replace('/', '-', $menu['items'][$mid]['path']);
if (count($menu['visible'][$mid]['children']) > 0) {
$output['content'].= "<li id='menu-$mid' class=\"menuparent $path_class\">".menu_item_link($mid);
$output['content'].= "<ul>";
$tmp = _nice_menu_tree($mid);
$output['content'].= $tmp['content'];
$output['content'].= "</ul>";
$output['content'].= "</li>";
}
else {
$output['content'].= "<li id='menu-$mid' class=\"$path_class\">".menu_item_link($mid)."</li>";
}
}
}
return $output;
Pete.
Comments
Comment #1
add1sun commentedThis has already been fixed in HEAD and 5 but still needs to be ported back to 4.7
Comment #2
add1sun commentedBackported to 4.7.
Comment #3
(not verified) commented