You are here

public function StateMachine_Event::execute in State Machine 6

Same name and namespace in other branches
  1. 7.3 inc/base.inc \StateMachine_Event::execute()
  2. 7 inc/base.inc \StateMachine_Event::execute()
  3. 7.2 inc/base.inc \StateMachine_Event::execute()

Execute the event. Tests to make sure the current state is a valid origin state, checks the guard condition,

File

inc/base.inc, line 267

Class

StateMachine_Event

Code

public function execute() {
  if (!in_array($this->machine
    ->get_current_state(), $this->options['origin'])) {
    return FALSE;
  }
  if (!$this
    ->validate()) {
    return FALSE;
  }
  if (!empty($this->options['before_transition'])) {
    call_user_func($this->options['before_transition']);
  }
  return $this->options['target'];
}