public function StateFlowEntity::clean_history_entity in State Machine 7.3
Removes all non Entity API properties from the history_entity.
1 call to StateFlowEntity::clean_history_entity()
- StateFlowEntity::set_history_entity in modules/
state_flow_entity/ plugins/ state_flow_entity.inc - Set the state flow history entity.
File
- modules/
state_flow_entity/ plugins/ state_flow_entity.inc, line 340 - State Flow implementation of the State Machine class.
Class
- StateFlowEntity
- @file State Flow implementation of the State Machine class.
Code
public function clean_history_entity($history_entity) {
// If entity module is available, uses it's function to get all the
// properties and fields on the state_flow_history_entity.
if (module_exists('entity')) {
$sfhe_properties = array_keys(entity_get_all_property_info('state_flow_history_entity'));
}
else {
$property_info = state_flow_entity_entity_property_info();
$fields = field_info_instances('state_flow_history_entity', 'state_flow_history_entity');
$sfhe_properties = array_merge(array_keys($fields), array_keys($property_info['state_flow_history_entity']['properties']));
}
// @todo, These should be in the properties already.
$sfhe_properties = array_merge(array(
'event',
'event_comment',
), $sfhe_properties);
$clean_history_entity = new stdClass();
foreach ($sfhe_properties as $property) {
if (!empty($history_entity->{$property})) {
$clean_history_entity->{$property} = $history_entity->{$property};
}
}
return $clean_history_entity;
}