You are here

public function StateFlow::get_event in State Machine 6

Same name and namespace in other branches
  1. 7 modules/state_flow/plugins/state_flow.inc \StateFlow::get_event()
  2. 7.2 modules/state_flow/plugins/state_flow.inc \StateFlow::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.

Overrides StateMachine::get_event

File

modules/state_flow/plugins/state_flow.inc, line 112

Class

StateFlow

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 StateFlow_Event($this, $options);
  }
  return $this->events[$key];
}