function book_node_delete

cis7 book.module book_node_delete($node)
cle7 book.module book_node_delete($node)
elmsmedia7 book.module book_node_delete($node)
icor7 book.module book_node_delete($node)
meedjum_blog7 book.module book_node_delete($node)
mooc7 book.module book_node_delete($node)

Implements hook_node_delete().

1 call to book_node_delete()
views_bulk_operations_remove_from_book_action in sites/all/modules/ulmus/views_bulk_operations/actions/book.action.inc
Adds the action 'Remove node from a parent book'

File

modules/book/book.module, line 964
Allows users to create and organize related content in an outline.

Code

function book_node_delete($node) {
  if (!empty($node->book['bid'])) {
    if ($node->nid == $node->book['bid']) {
      // Handle deletion of a top-level post.
      $result = db_query("SELECT b.nid FROM {menu_links} ml INNER JOIN {book} b on b.mlid = ml.mlid WHERE ml.plid = :plid", array(
        ':plid' => $node->book['mlid'],
      ));
      foreach ($result as $child) {
        $child_node = node_load($child->nid);
        $child_node->book['bid'] = $child_node->nid;
        _book_update_outline($child_node);
      }
    }
    menu_link_delete($node->book['mlid']);
    db_delete('book')->condition('mlid', $node->book['mlid'])->execute();
    drupal_static_reset('book_get_books');
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.