You are here

public function StateMachine::get_available_events in State Machine 7.3

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

Returns an array of events that are valid for the current state.

2 calls to StateMachine::get_available_events()
StateFlowEntity::get_available_events_options in modules/state_flow_entity/plugins/state_flow_entity.inc
Get available events as an array suitable for FAPI.
StateFlowEntity::get_default_event_name in modules/state_flow_entity/plugins/state_flow_entity.inc
Get a default event.

File

inc/base.inc, line 221
Defines the base classes of the state machine.

Class

StateMachine
The base class.

Code

public function get_available_events() {
  $events = array();
  foreach ($this->events as $key => $event) {
    $event_object = $this
      ->get_event($key);
    if ($this
      ->get_event($key)
      ->can_transition_from($this
      ->get_current_state())) {
      $events[$key] = $event_object;
    }
  }
  return $events;
}