You are here

function state_flow_live_revision in State Machine 7

Same name and namespace in other branches
  1. 6 modules/state_flow/state_flow.module \state_flow_live_revision()
  2. 7.2 modules/state_flow/state_flow.module \state_flow_live_revision()

Helper function to return node_revision_states records for all published revisions of a node.

1 call to state_flow_live_revision()
state_flow_prevent_live_revision in modules/state_flow/state_flow.module
Checks whether the version of the node being saved is in the published state, and if not, re-saves the latest published revision.

File

modules/state_flow/state_flow.module, line 476
An implementation of node revision workflow for Drupal based on the State Machine system.

Code

function state_flow_live_revision($nid) {
  $state = variable_get('state_flow_published_state', 'published');
  $revision_state = db_query('
      SELECT *
      FROM {node_revision_states}
      WHERE nid = :nid
      AND status = 1
      AND state = :state
      ORDER BY vid DESC
      LIMIT 0, 1', array(
    ':nid' => $nid,
    ':state' => $state,
  ))
    ->fetchAll();
  return $revision_state;
}