You are here

function nodeblock_node_delete in Nodeblock 7

Implements hook_node_delete().

1 call to nodeblock_node_delete()
nodeblock_node_update in ./nodeblock.module
Implements hook_node_update().

File

./nodeblock.module, line 435
Enables use of specified node types as custom blocks.

Code

function nodeblock_node_delete($node) {
  if (_nodeblock_table_exists()) {
    $machine_names[] = $node->nid;
    if (isset($node->nodeblock['machine_name'])) {
      $machine_names[] = $node->nodeblock['machine_name'];
    }
    $result = db_delete('nodeblock')
      ->condition('nid', $node->nid)
      ->execute();
    if ($result) {
      db_delete('block')
        ->condition('module', 'nodeblock')
        ->condition('delta', $machine_names, 'IN')
        ->execute();
      db_delete('block_role')
        ->condition('module', 'nodeblock')
        ->condition('delta', $machine_names, 'IN')
        ->execute();
      db_delete('block_node_type')
        ->condition('module', 'nodeblock')
        ->condition('delta', $machine_names, 'IN')
        ->execute();
    }
  }
}