public function StateMachine_Event::validate in State Machine 7
Same name and namespace in other branches
- 6 inc/base.inc \StateMachine_Event::validate()
- 7.3 inc/base.inc \StateMachine_Event::validate()
- 7.2 inc/base.inc \StateMachine_Event::validate()
Validate that the given event can take place.
2 calls to StateMachine_Event::validate()
- StateFlow_Event::validate in modules/
state_flow/ plugins/ state_flow.inc - Validate that the given event can take place.
- StateMachine_Event::execute in inc/
base.inc - Execute the event.
1 method overrides StateMachine_Event::validate()
- StateFlow_Event::validate in modules/
state_flow/ plugins/ state_flow.inc - Validate that the given event can take place.
File
Class
Code
public function validate() {
// Check that the current state is a valid origin for the given transition.
if (!in_array($this->machine
->get_current_state(), $this->options['origin'])) {
return FALSE;
}
// Execute guard condition if it exists.
if (!empty($this->options['guard'])) {
if (call_user_func($this->options['guard'], $this) === FALSE) {
return FALSE;
}
}
return TRUE;
}