function _oa_clone_og_menu_traverse_tree in Open Atrium Clone 7.2
Clones the node links of the og menu.
1 call to _oa_clone_og_menu_traverse_tree()
- oa_clone_batch_og_menu_clone in ./
oa_clone.module - Callback for cloning all the content in a section.
File
- ./
oa_clone.module, line 800
Code
function _oa_clone_og_menu_traverse_tree(&$tree, $plid, $map) {
if (!empty($tree['node_links'])) {
foreach ($tree['node_links'] as $nid => $links) {
foreach ($links as $mlid => $link) {
if ($new_nid = array_search($nid, $map)) {
$new_link = _oa_clone_clone_menu_link($link, $plid, $new_nid);
$tree['tree'][$mlid]['new_link'] = $new_link;
}
}
}
}
if (!empty($tree['tree'])) {
foreach ($tree['tree'] as $tree_mlid => $info) {
if (empty($info['new_link']['mlid'])) {
// manual link to non-node, so copy as is
$new_link = _oa_clone_clone_menu_link($info['link'], $plid);
$tree['tree'][$tree_mlid]['new_link'] = $new_link;
}
if (!empty($info['new_link']['mlid']) && ($child_tree = _menu_build_tree(OG_MENU_SINGLE_MENU_NAME, array(
'expanded' => array(
$tree_mlid,
),
'min_depth' => $info['link']['depth'] + 1,
)))) {
$tree['tree'][$tree_mlid]['below'] = $child_tree;
_oa_clone_og_menu_traverse_tree($tree['tree'][$tree_mlid]['below'], $info['new_link']['mlid'], $map);
}
}
}
}