public function StateMachine::get_event in State Machine 7.3
Same name and namespace in other branches
- 6 inc/base.inc \StateMachine::get_event()
- 7 inc/base.inc \StateMachine::get_event()
- 7.2 inc/base.inc \StateMachine::get_event()
Return an event instance by key, lazy-loading the instance if necessary.
Parameters
string $key: The string identifier of the event to be returned.
Return value
StateMachine_Event|FALSE An instance of StateMachine_Event, or FALSE if the key specified does not represent a valid event.
2 calls to StateMachine::get_event()
- StateMachine::fire_event in inc/
base.inc - Trigger an event to process a transition.
- StateMachine::get_available_events in inc/
base.inc - Returns an array of events that are valid for the current state.
1 method overrides StateMachine::get_event()
- StateFlowEntity::get_event in modules/
state_flow_entity/ plugins/ state_flow_entity.inc - Return an event.
File
- inc/
base.inc, line 165 - Defines the base classes of the state machine.
Class
- StateMachine
- The base class.
Code
public 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($key, $this, $options);
}
return $this->events[$key];
}