function _og_menu_single_children_items in OG Menu Single 7
Helper function to populate the menu tree without loading the entire tree.
1 call to _og_menu_single_children_items()
- og_menu_single_children_items in ./
og_menu_single.module - Fetches all children of a given parent link.
File
- ./
og_menu_single.module, line 481 - Creates a single menu per organic group on a site.
Code
function _og_menu_single_children_items($plid, $current_depth, $max_depth) {
$menu_links =& drupal_static(__FUNCTION__, array());
$tree = array();
// current depth should always be same for a given plid.
if (!isset($menu_links[$plid])) {
$menu_links[$plid] = menu_build_tree(OG_MENU_SINGLE_MENU_NAME, array(
'expanded' => array(
$plid,
),
'min_depth' => $current_depth,
));
}
foreach ($menu_links[$plid] as $key => $item) {
if (module_exists('i18n_menu')) {
_i18n_menu_link_localize($item['link']);
}
$tree[$key] = $item;
if ($current_depth < $max_depth) {
$tree[$key]['below'] = _og_menu_single_children_items($item['link']['mlid'], $current_depth + 1, $max_depth);
}
}
return $tree;
}