You are here

public function StateFlowEntity::get_default_event_name in State Machine 7.3

Get a default event.

When the event form is embedded on the node edit form or elsewhere it may be the case that the state does not change. The method checks for an event that has a target state that matches the current state.

Return value

string|NULL An event name or NULL.

1 call to StateFlowEntity::get_default_event_name()
StateFlowEntity::entityPresave in modules/state_flow_entity/plugins/state_flow_entity.inc
Called by hook_entity_presave().

File

modules/state_flow_entity/plugins/state_flow_entity.inc, line 972
State Flow implementation of the State Machine class.

Class

StateFlowEntity
@file State Flow implementation of the State Machine class.

Code

public function get_default_event_name() {
  foreach ($this
    ->get_available_events() as $event) {
    $target = $event
      ->get_option('target');
    if ($target === $this->current) {
      return $event->name;
    }
  }
  return NULL;
}