public function StateMachine::get_state in State Machine 7.3
Same name and namespace in other branches
- 6 inc/base.inc \StateMachine::get_state()
- 7 inc/base.inc \StateMachine::get_state()
- 7.2 inc/base.inc \StateMachine::get_state()
Return a state instance by key, lazy-loading the instance if necessary.
Parameters
string $key: The string identifier of the state to be returned.
Return value
StateMachine_State An instance of StateMachine_State, or FALSE if the key specified does not represent a valid state.
1 call to StateMachine::get_state()
- StateFlowEntity::get_label_for_current_state in modules/
state_flow_entity/ plugins/ state_flow_entity.inc - Get the label for the current state.
File
- inc/
base.inc, line 77 - Defines the base classes of the state machine.
Class
- StateMachine
- The base class.
Code
public function get_state($key) {
if (!array_key_exists($key, $this->states)) {
return FALSE;
}
if (is_array($this->states[$key])) {
$options = $this->states[$key];
$this->states[$key] = new StateMachine_State($key, $this, $options);
}
return $this->states[$key];
}