You are here

function workflow_update_workflow_node in Workflow 7

Same name and namespace in other branches
  1. 7.2 workflow.module \workflow_update_workflow_node()

Given data, insert the node association. @todo: Can we split this in 2? First half for Node API, second half for Node + Field API.

2 calls to workflow_update_workflow_node()
WorkflowState::deactivate in includes/Entity/WorkflowState.php
Deactivate a Workflow State, moving existing nodes to a given State.
WorkflowTransition::execute in includes/Entity/WorkflowTransition.php
Execute a transition (change state of a node). @deprecated: workflow_execute_transition() --> WorkflowTransition::execute().

File

./workflow.module, line 976
Support workflows made up of arbitrary states.

Code

function workflow_update_workflow_node($data, $old_sid, $comment = NULL) {
  $data = (object) $data;
  if (isset($data->nid) && workflow_get_workflow_node_by_nid($data->nid)) {
    drupal_write_record('workflow_node', $data, 'nid');
  }
  else {
    drupal_write_record('workflow_node', $data);
  }

  // Write to history for this node.
  $data = array(
    'nid' => $data->nid,
    'old_sid' => $old_sid,
    'sid' => $data->sid,
    'uid' => $data->uid,
    'stamp' => $data->stamp,
    'comment' => $comment,
  );
  workflow_insert_workflow_node_history($data);
}