You are here

protected function FieldCollectionItemEntity::deleteHostEntityReference in Field collection 7

Deletes the host entity's reference of the field collection item.

2 calls to FieldCollectionItemEntity::deleteHostEntityReference()
FieldCollectionItemEntity::delete in ./field_collection.entity.inc
Deletes the field collection item and the reference in the host entity.
FieldCollectionItemEntity::deleteRevision in ./field_collection.entity.inc
Intelligently delete a field collection item revision.

File

./field_collection.entity.inc, line 563

Class

FieldCollectionItemEntity
Class for field_collection_item entities.

Code

protected function deleteHostEntityReference() {
  $delta = $this
    ->delta();
  if ($this->item_id && isset($delta)) {
    unset($this->hostEntity->{$this->field_name}[$this
      ->langcode()][$delta]);

    // Do not save when the host entity is being deleted. See
    // field_collection_field_delete().
    if (empty($this->hostEntity->field_collection_deleting)) {
      entity_save($this
        ->hostEntityType(), $this
        ->hostEntity());
    }
  }
}