function entity_translation_uuid_entities_features_export_entity_alter in Entity Translation 7
Implements hook_uuid_entities_features_export_entity_alter().
File
- ./
entity_translation.module, line 2015
Code
function entity_translation_uuid_entities_features_export_entity_alter($entity, $entity_type) {
// We do not need to export most of the keys:
// - The entity type is determined from the entity the translations are
// attached to.
// - The entity id will change from one site to another.
// - The user id needs to be removed because it will change as well.
// - Created and changed could be left but the UUID module removes created and
// changed values from the entities it exports, hence we do the same for
// consistency.
if (entity_translation_enabled($entity_type, $entity)) {
$fields = array(
'entity_type',
'entity_id',
'uid',
'created',
'changed',
);
$handler = entity_translation_get_handler($entity_type, $entity);
$translations = $handler
->getTranslations();
if ($translations && isset($translations->data)) {
foreach ($translations->data as &$translation) {
foreach ($fields as $field) {
unset($translation[$field]);
}
}
}
}
}