You are here

public function StateFlow::revision_state_record in State Machine 7.2

Same name and namespace in other branches
  1. 7 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 370

Class

StateFlow

Code

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