You are here

public function StateFlow::revision_state_record in State Machine 7

Same name and namespace in other branches
  1. 7.2 modules/state_flow/plugins/state_flow.inc \StateFlow::revision_state_record()
1 call to StateFlow::revision_state_record()
StateFlow::set_node_revision in modules/state_flow/plugins/state_flow.inc

File

modules/state_flow/plugins/state_flow.inc, line 296

Class

StateFlow

Code

public function revision_state_record($nid, $vid = NULL) {
  if (!empty($vid)) {
    $rev_state = db_query('
        SELECT *
        FROM {node_revision_states}
        WHERE vid = :vid
        LIMIT 0, 1', array(
      ':vid' => $vid,
    ))
      ->fetchAll();
  }
  else {
    $rev_state = db_query('
        SELECT state
        FROM {node_revision_states}
        WHERE nid = :nid
        ORDER BY vid DESC
        LIMIT 0, 1', array(
      ':nid' => $nid,
    ))
      ->fetchAll();
  }
  return isset($rev_state[0]->nid) ? $rev_state[0] : FALSE;
}