function book_copy_batch_copy in Book Copy 6
This function defines our batch book copy process and starts it Error checking ensures that we have a valid book, and generates a warning if the user tries to copy a non book
Parameters
object $book a node representing the book we want to copy:
int $subtree The nid to start cloning from if 0 all book pages will be copied: if non-zero then only those nodes under the given nid in the tree hierarchy will be copied
1 string reference to 'book_copy_batch_copy'
- book_copy_menu in ./
book_copy.module - implementation of hook_menu
File
- ./
book_copy.module, line 196
Code
function book_copy_batch_copy($book, $subtree = 0) {
if (!empty($book->book['bid'])) {
return drupal_get_form('book_copy_confirm_copy', $book, $subtree);
}
else {
drupal_set_title(t('Error copying book'));
if (!empty($book->title)) {
drupal_set_message(t('%title is not a book', array(
'%title' => $book->title,
)), 'warning');
drupal_goto('node/' . $book->nid);
}
else {
drupal_set_message(t('Could not find book corresponding to nid: %nid', array(
'%nid' => $bid,
)), 'warning');
}
}
}