You are here

protected function StateMachine::get_event in State Machine 6

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

Return an event instance by key, lazy-loading the instance if necessary.

Parameters

$key: The string identifier of the event to be returned.

Return value

An instance of StateMachine_Event, or FALSE if the key specified does not represent a valid event.

1 call to StateMachine::get_event()
StateMachine::fire_event in inc/base.inc
Trigger an event to process a transition. Callbacks and guard conditions will be processed in the following order:
1 method overrides StateMachine::get_event()
StateFlow::get_event in modules/state_flow/plugins/state_flow.inc
Return an event instance by key, lazy-loading the instance if necessary.

File

inc/base.inc, line 140

Class

StateMachine

Code

protected function get_event($key) {
  if (!array_key_exists($key, $this->events)) {
    return FALSE;
  }
  if (is_array($this->events[$key])) {
    $options = $this->events[$key];
    $this->events[$key] = new StateMachine_Event($this, $options);
  }
  return $this->events[$key];
}