You are here

protected function StateMachine::set_current_state in State Machine 7.3

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

Set the current state to the state identified by the specified key.

4 calls to StateMachine::set_current_state()
StateFlowEntity::entityPresave in modules/state_flow_entity/plugins/state_flow_entity.inc
Called by hook_entity_presave().
StateFlowEntity::__construct in modules/state_flow_entity/plugins/state_flow_entity.inc
Create instance of StateMachine.
StateMachine::fire_event in inc/base.inc
Trigger an event to process a transition.
StateMachine::__construct in inc/base.inc
Create instance of StateMachine.

File

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

Class

StateMachine
The base class.

Code

protected function set_current_state($key) {
  if (array_key_exists($key, $this->states)) {
    $this->current = $key;
    return TRUE;
  }
  return FALSE;
}