You are here

function workflow_node_delete in Workflow 7

Implements hook_node_delete().

File

./workflow.node.inc, line 127
Node specific functions, remnants of nodeapi.

Code

function workflow_node_delete($node) {
  $node->workflow_stamp = REQUEST_TIME;

  // Delete the association of node to state.
  workflow_delete_workflow_node_by_nid($node->nid);
  if (!empty($node->workflow)) {
    global $user;
    $data = array(
      'nid' => $node->nid,
      'old_sid' => $node->workflow,
      'sid' => WORKFLOW_DELETION,
      'uid' => $user->uid,
      'stamp' => $node->workflow_stamp,
      'comment' => t('Node deleted'),
    );
    workflow_insert_workflow_node_history($data);
  }

  // Delete any scheduled transitions for this node.
  WorkflowScheduledTransition::deleteByNid('node', $node->nid);
}