function _book_copy_list_recurse in Book Copy 7.2
Recursive function to build an ordered list of menu items for comparison
1 call to _book_copy_list_recurse()
- _book_copy_list in ./
book_copy.module  - When passed a book link, assemble an array of nids => mlids based on _book_toc_recurse and book_toc
 
File
- ./
book_copy.module, line 364  - Book copy, copy book outlines
 
Code
function _book_copy_list_recurse($tree, $book_link, &$copytree, $copy_down) {
  // loop through the tree
  $just_set = FALSE;
  foreach ($tree as $data) {
    // once we have the book_link in question, start copying
    if ($data['link']['mlid'] == $book_link['mlid']) {
      // only copy items once we match the mlid in question
      $copy_down = TRUE;
      $just_set = TRUE;
    }
    // only store below the item we are targetting
    if ($copy_down) {
      // find the nid in link_path
      $nid = str_replace('node/', '', $data['link']['link_path']);
      // load the parent item
      if ($data['link']['plid'] != 0) {
        $parent = menu_link_load($data['link']['plid']);
        $pnid = str_replace('node/', '', $parent['link_path']);
      }
      else {
        $pnid = 0;
      }
      // save relationship of current node to parent id
      $copytree[$nid] = $pnid;
    }
    // if this level has data below it, decend into it
    if ($data['below']) {
      _book_copy_list_recurse($data['below'], $book_link, $copytree, $copy_down);
    }
    // if copy down was just set, make sure this branch escapes early
    if ($just_set) {
      break;
    }
  }
}