You are here

public function ViewsReferenceItem::hasNewEntity in Views Reference Field 8

Determines whether the item holds an unsaved entity.

This is notably used for "autocreate" widgets, and more generally to support referencing freshly created entities (they will get saved automatically as the hosting entity gets saved).

Return value

bool TRUE if the item holds an unsaved entity.

Overrides EntityReferenceItem::hasNewEntity

File

src/Plugin/Field/FieldType/ViewsReferenceItem.php, line 184

Class

ViewsReferenceItem
Defines the 'viewsreference' entity field type.

Namespace

Drupal\viewsreference\Plugin\Field\FieldType

Code

public function hasNewEntity() {
  return !$this
    ->isEmpty() && $this->target_id === NULL && $this->entity
    ->isNew();
}