public function StateFlowEntity::load in State Machine 7.3
Provide the current state of this revision or entity.
Return value
string The state machine name.
Overrides StateMachine::load
2 calls to StateFlowEntity::load()
- StateFlowEntity::__construct in modules/
state_flow_entity/ plugins/ state_flow_entity.inc - Create instance of StateMachine.
- StateFlowNode::load in modules/
state_flow/ plugins/ state_flow_node.inc - Provide the current state of this revision or entity.
1 method overrides StateFlowEntity::load()
- StateFlowNode::load in modules/
state_flow/ plugins/ state_flow_node.inc - Provide the current state of this revision or entity.
File
- modules/
state_flow_entity/ plugins/ state_flow_entity.inc, line 918 - State Flow implementation of the State Machine class.
Class
- StateFlowEntity
- @file State Flow implementation of the State Machine class.
Code
public function load() {
$state = FALSE;
$entity_type = $this
->get_entity_type();
$entity_info = entity_get_info($entity_type);
$id_key = $entity_info['entity keys']['id'];
$revision_key = $entity_info['entity keys']['revision'];
if (!empty($this->object->{$id_key}) && !empty($this->object->{$revision_key})) {
$state = $this
->revision_state($this->object->{$id_key}, $this->object->{$revision_key});
}
elseif (!empty($this->object->{$id_key})) {
$state = $this
->latest_state($this->object->{$id_key});
}
return $state;
}