You are here

public function StateFlowEntity::revision_state in State Machine 7.3

Return the state of the revision

1 call to StateFlowEntity::revision_state()
StateFlowEntity::load in modules/state_flow_entity/plugins/state_flow_entity.inc
Provide the current state of this revision or entity.

File

modules/state_flow_entity/plugins/state_flow_entity.inc, line 937
State Flow implementation of the State Machine class.

Class

StateFlowEntity
@file State Flow implementation of the State Machine class.

Code

public function revision_state($entity_id, $revision_id) {
  $latest_state = db_select('state_flow_history', 'sfh')
    ->fields('sfh', array(
    'state',
  ))
    ->condition('entity_id', $entity_id)
    ->condition('revision_id', $revision_id)
    ->orderBy('hid', 'DESC')
    ->range(0, 1)
    ->execute()
    ->fetchCol('state');
  return !empty($latest_state[0]) ? $latest_state[0] : FALSE;
}