diff --git a/field_collection.module b/field_collection.module index bf6a005..14b16e2 100644 --- a/field_collection.module +++ b/field_collection.module @@ -886,6 +886,8 @@ function field_collection_field_settings_form($field, $instance) { * creation or to save changes to the host entity and its collections at once. */ function field_collection_field_presave($host_entity_type, $host_entity, $field, $instance, $langcode, &$items) { + $force_new_entity = $host_entity->is_new || !empty($host_entity->translation_source); + foreach ($items as &$item) { // In case the entity has been changed / created, save it and set the id. // If the host entity creates a new revision, save new item-revisions as @@ -893,7 +895,13 @@ function field_collection_field_presave($host_entity_type, $host_entity, $field, if (isset($item['entity']) || !empty($host_entity->revision)) { if ($entity = field_collection_field_get_entity($item)) { - + + if ($force_new_entity) { + $entity->item_id = NULL; + $entity->revision_id = NULL; + $entity->is_new = TRUE; + } + if (!empty($entity->is_new)) { $entity->setHostEntity($host_entity_type, $host_entity, LANGUAGE_NONE, FALSE); }