You are here

public function FieldCollection::isEmpty in Field collection 8.3

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldType/FieldCollection.php \Drupal\field_collection\Plugin\Field\FieldType\FieldCollection::isEmpty()

Determines whether the data structure is empty.

Return value

bool TRUE if the data structure is empty, FALSE otherwise.

Overrides EntityReferenceItem::isEmpty

File

src/Plugin/Field/FieldType/FieldCollection.php, line 267

Class

FieldCollection
Plugin implementation of the 'field_collection' field type.

Namespace

Drupal\field_collection\Plugin\Field\FieldType

Code

public function isEmpty() {
  if ($this->target_id) {
    return FALSE;
  }
  else {
    if ($this
      ->getFieldCollectionItem()) {
      return $this
        ->getFieldCollectionItem()
        ->isEmpty();
    }
  }
  return TRUE;
}