You are here

function drush_book_copy_copy_book in Book Copy 7.2

Drush command callback for copying a book or part of a book

File

./book_copy.drush.inc, line 40
Drush integration for Book Copy module.

Code

function drush_book_copy_copy_book($nid, $title = NULL) {
  if (empty($nid)) {
    drush_log(dt('Node id is required in order to copy anything'), 'error');
    return FALSE;
  }
  else {
    $node = node_load($nid);

    // exact copy if no title was defined
    if (is_null($title)) {
      $title = $node->title;
    }
    book_copy_process_copy($nid, $node->title, $title, FALSE);
    drush_log(dt("Outline @title successfully copied to @newtitle!", array(
      '@title' => $node->title,
      '@newtitle' => $title,
    )), 'ok');
    return TRUE;
  }
}