function og_subgroups_menu_tree_recurse in Subgroups for Organic groups 5
Same name and namespace in other branches
- 5.4 og_subgroups.module \og_subgroups_menu_tree_recurse()
Helper function for og_subgroups_menu_tree()
1 call to og_subgroups_menu_tree_recurse()
- og_subgroups_menu_tree in ./
og_subgroups.module - Returns an HTML nested list (wrapped in a menu-class div) representing the group nodes as a tree.
File
- ./
og_subgroups.module, line 532 - Maintains subgroups hierarchy created by the orgainc groups module.
Code
function og_subgroups_menu_tree_recurse($gid, $inaccessibale, $children = array()) {
$children = og_subgroups_get_family($gid, 'down');
foreach ($children as $node) {
// Check group isn't inaccessibale for user.
!in_array($node->gid, $inaccessibale) ? $title = $node->title : ($title = t('<private group>'));
if ($tree = og_subgroups_menu_tree_recurse($node->gid, $inaccessibale, $children)) {
$output .= '<li class="expanded">';
$output .= l($title, 'node/' . $node->gid);
$output .= '<ul class="menu">' . $tree . '</ul>';
$output .= '</li>';
}
else {
$output .= '<li class="leaf">' . l($title, 'node/' . $node->gid) . '</li>';
}
}
return $output;
}