You are here

function hook_entity_translation_source_field_state_alter in Entity Translation 7

Allows to sets the right values in the form state when adding a translation.

File

./entity_translation.api.php, line 171
API documentation for the Entity translation module.

Code

function hook_entity_translation_source_field_state_alter(&$field_state) {
  if (isset($field_state['entity'])) {
    module_load_include('inc', 'entity', 'includes/entity.ui');
    foreach ($field_state['entity'] as $delta => $entity) {
      if ($entity instanceof FieldCollectionItemEntity) {
        $field_state['entity'][$delta] = entity_ui_clone_entity('field_collection_item', $entity);
      }
    }
  }
}