You are here

public function StateFlow::latest_state in State Machine 7.2

Same name and namespace in other branches
  1. 6 modules/state_flow/plugins/state_flow.inc \StateFlow::latest_state()
  2. 7 modules/state_flow/plugins/state_flow.inc \StateFlow::latest_state()
1 call to StateFlow::latest_state()
StateFlow::load in modules/state_flow/plugins/state_flow.inc
Load the current state from the given state storage

File

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

Class

StateFlow

Code

public function latest_state($nid) {
  $latest_state = db_query_range('
      SELECT state
      FROM {node_revision_states}
      WHERE nid = :nid
      AND status = 1
      AND vid = :vid
      ORDER BY timestamp DESC', 0, 1, array(
    ':nid' => $nid,
    ':vid' => $this
      ->get_latest_revision($nid),
  ))
    ->fetchCol('state');
  return !empty($latest_state[0]) ? $latest_state[0] : FALSE;
}