public function StateMachine_Event::validate in State Machine 7.3
Same name and namespace in other branches
- 6 inc/base.inc \StateMachine_Event::validate()
- 7 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_entity/ plugins/ state_flow_entity.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_entity/ plugins/ state_flow_entity.inc - Validate that the given event can take place.
File
- inc/
base.inc, line 393 - Defines the base classes of the state machine.
Class
- StateMachine_Event
- Base class for events.
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;
}