protected function StateMachine::create_event in State Machine 6
Same name and namespace in other branches
- 7.3 inc/base.inc \StateMachine::create_event()
- 7 inc/base.inc \StateMachine::create_event()
- 7.2 inc/base.inc \StateMachine::create_event()
Create a new event. This method does not actually create an event instance, it only stores the options array until an instance is requested from get_event().
Parameters
$key: The string identifier for this event. Must be unique within the scope of the State Machine.
$options: An array of options that will be passed into the Event constructor.
- title: The human-readable title of the event.
- origin: A key or array of keys representing the valid origin state(s) for this event.
- target: The key of the state which this event will transition to.
- guard: A callback to be fired before the event. If this function returns FALSE, the event will be cancelled.
- before_transition: A callback to be fired after the guard condition, but before the transition.
- after_transition: A callback to be fired after the completion of the transition.
2 calls to StateMachine::create_event()
- StateFlow::init in modules/
state_flow/ plugins/ state_flow.inc - Initialize the state machine using the provided addState and addEvent methods.
- StateMachine_Test::init in tests/
state_machine.test - Called from StateMachine::__construct to initialize the states and events.
File
- inc/
base.inc, line 127
Class
Code
protected function create_event($key, $options = array()) {
$this->events[$key] = $options;
}