diff --git a/field_collection.entity.inc b/field_collection.entity.inc index 9369bc4..7969841 100644 --- a/field_collection.entity.inc +++ b/field_collection.entity.inc @@ -231,7 +231,7 @@ class FieldCollectionItemEntity extends Entity { } list($recieved_id) = entity_extract_ids($this->hostEntityType, $entity); - if ($this->isInUse()) { + if ($this->isInUse() && !empty($this->hostEntityId)) { $current_id = $this->hostEntityId; } else { diff --git a/field_collection.module b/field_collection.module index 8c98599..8bfd5c3 100644 --- a/field_collection.module +++ b/field_collection.module @@ -1431,6 +1431,12 @@ function field_collection_remove_submit($form, &$form_state) { */ function field_collection_field_get_entity(&$item, $field_name = NULL) { if (isset($item['entity'])) { + if (count($item) > 1) { + // If $item contains more thing than 'entity', then it is sent from VBO. + // We clone the object to avoid that the same field collection item of the + // faked object is attached to multiple host objects. + return clone($item['entity']); + } return $item['entity']; } elseif (isset($item['value'])) {