You are here

function book_node_import_postprocess in Node import 6

Implementation of hook_node_import_postprocess().

File

supported/book.inc, line 239
Support file for the core book module.

Code

function book_node_import_postprocess($type, $values, $options, $preview) {
  if (!$preview && isset($values['nid']) && ($node_type = node_import_type_is_node($type)) !== FALSE && book_type_is_allowed($node_type) && (user_access('administer book outlines') || user_access('add content to books')) && isset($values['book']['plid']) && $values['book']['plid'] > 0 && ($mlid = db_result(db_query("SELECT mlid FROM {menu_links} WHERE module = 'book' AND link_path = '%s'", 'node/' . $values['nid'])))) {
    $menu_link = array(
      'menu_name' => book_menu_name($values['book']['bid']),
      'weight' => $values['book']['weight'],
      'mlid' => $mlid,
      'plid' => $values['book']['plid'],
      'router_path' => 'node/%',
      'link_path' => 'node/' . $values['nid'],
      'link_title' => $values['title'],
      'module' => 'book',
    );
    menu_link_save($menu_link);
  }
}