You are here

protected function StateMachine::get_state in State Machine 7.2

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

Return a state instance by key, lazy-loading the instance if necessary.

Parameters

$key string: 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()
StateFlow::get_label_for_current_state in modules/state_flow/plugins/state_flow.inc
Get the label for the current state

File

inc/base.inc, line 65
base.inc

Class

StateMachine
@file base.inc

Code

protected 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];
}