You are here

public function EntityReferenceRevisionsItem::isEmpty in Entity Reference Revisions 8

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/EntityReferenceRevisionsItem.php, line 238

Class

EntityReferenceRevisionsItem
Defines the 'entity_reference_revisions' entity field type.

Namespace

Drupal\entity_reference_revisions\Plugin\Field\FieldType

Code

public function isEmpty() {

  // Avoid loading the entity by first checking the 'target_id'.
  if ($this->target_id !== NULL && $this->target_revision_id !== NULL) {
    return FALSE;
  }
  if ($this->entity && $this->entity instanceof EntityInterface) {
    return FALSE;
  }
  return TRUE;
}