function book_remove_form_submit

7.x book.pages.inc book_remove_form_submit($form, &$form_state)
6.x book.pages.inc book_remove_form_submit($form, &$form_state)

Confirm form submit function to remove a node from the book.

See also

book_remove_form()

File

drupal-6.x/modules/book/book.pages.inc, line 217
User page callbacks for the book module.

Code

function book_remove_form_submit($form, &$form_state) {
  $node = $form['#node'];
  if ($node->nid != $node->book['bid']) {
    // Only allowed when this is not a book (top-level page).
    menu_link_delete($node->book['mlid']);
    db_query('DELETE FROM {book} WHERE nid = %d', $node->nid);
    drupal_set_message(t('The post has been removed from the book.'));
  }
  $form_state['redirect'] = 'node/' . $node->nid;
}