You are here

public function StateMachine::get_current_state in State Machine 7.3

Same name and namespace in other branches
  1. 6 inc/base.inc \StateMachine::get_current_state()
  2. 7 inc/base.inc \StateMachine::get_current_state()
  3. 7.2 inc/base.inc \StateMachine::get_current_state()

Returns the current state.

6 calls to StateMachine::get_current_state()
StateFlowEntity::entity_saved in modules/state_flow_entity/plugins/state_flow_entity.inc
Called by hook_entity_insert() / hook_entity_update().
StateFlowEntity::get_available_events_options in modules/state_flow_entity/plugins/state_flow_entity.inc
Get available events as an array suitable for FAPI.
StateFlowEntity::get_history_entity in modules/state_flow_entity/plugins/state_flow_entity.inc
Get the state flow history entity.
StateFlowEntity::get_label_for_current_state in modules/state_flow_entity/plugins/state_flow_entity.inc
Get the label for the current state.
StateFlowEntity::write_history in modules/state_flow_entity/plugins/state_flow_entity.inc
Write the transaction to the history table.

... See full list

File

inc/base.inc, line 104
Defines the base classes of the state machine.

Class

StateMachine
The base class.

Code

public function get_current_state() {
  if (!$this->current) {
    if (!empty($this->default_state)) {
      $this->current = $this->default_state;
    }
    else {
      $this->current = key($this->states);
    }
  }
  return $this->current;
}