function EntityReferenceUuidItem::isEmpty

Same name and namespace in other branches
  1. 11.x core/modules/jsonapi/tests/modules/jsonapi_test_field_type/src/Plugin/Field/FieldType/EntityReferenceUuidItem.php \Drupal\jsonapi_test_field_type\Plugin\Field\FieldType\EntityReferenceUuidItem::isEmpty()

Overrides EntityReferenceItem::isEmpty

2 calls to EntityReferenceUuidItem::isEmpty()
EntityReferenceUuidItem::hasNewEntity in core/modules/jsonapi/tests/modules/jsonapi_test_field_type/src/Plugin/Field/FieldType/EntityReferenceUuidItem.php
Determines whether the item holds an unsaved entity.
EntityReferenceUuidItem::preSave in core/modules/jsonapi/tests/modules/jsonapi_test_field_type/src/Plugin/Field/FieldType/EntityReferenceUuidItem.php

File

core/modules/jsonapi/tests/modules/jsonapi_test_field_type/src/Plugin/Field/FieldType/EntityReferenceUuidItem.php, line 167

Class

EntityReferenceUuidItem
Defines the 'entity_reference_uuid' entity field type.

Namespace

Drupal\jsonapi_test_field_type\Plugin\Field\FieldType

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.