You are here

function oa_clone_batch_og_menu_clone in Open Atrium Clone 7.2

Callback for cloning all the content in a section.

Parameters

object $space: Cloned space object

@param array &$context: A place where we can store values that need to b passed from one iteration of this batch operation to the next.

1 string reference to 'oa_clone_batch_og_menu_clone'
_oa_clone_batch_space in ./oa_clone.module
Recursively clone a Space while setting up a batch for cloning content.

File

./oa_clone.module, line 784

Code

function oa_clone_batch_og_menu_clone($space, $original_space_nid, &$context) {
  $new_mlid = og_menu_single_get_link_mlid_or_create('node', $space->nid);
  if ($mlid = og_menu_single_get_link_mlid('node', $original_space_nid)) {
    $link = menu_link_load($mlid);
    $tree = _menu_build_tree(OG_MENU_SINGLE_MENU_NAME, array(
      'expanded' => array(
        $mlid,
      ),
      'min_depth' => $link['depth'] + 1,
    ));
    if (!empty($tree['tree'])) {
      $_SESSION['oa_clone_map'][$space->nid] = $original_space_nid;
      _oa_clone_og_menu_traverse_tree($tree, $new_mlid, $_SESSION['oa_clone_map']);
    }
  }
  unset($_SESSION['oa_clone_map']);
}