I'm building a function that takes a drupal rendered menu and removes the classes from it so that I can pass it to a jQuery function that'll build a menu from it.
The code i'm using for that is:-
<?php
$tree = menu_tree_all_data("devel-frus");
$menu = drupal_render(menu_tree_output($tree));
$nocss = preg_replace('/class=".*?"/', '', $menu);
echo($nocss);
?>
However menu_tree_output()
seems to be only returning the first level of a six level menu when it should be returning the complete menu.
I've tried dsm()
'ing $tree
to see if all of the menu items are being returned by menu_tree_all_data()
and that's fine, however when I dsm()
the output of the menu_tree_output()
function only the root and first level are returned in the array.
Am I doing something really obviously wrong here?