public function EntityReferenceRevisions::isTargetNew in Entity Reference Revisions 8
Checks whether the target entity has not been saved yet.
Return value
bool TRUE if the entity is new, FALSE otherwise.
Overrides EntityReference::isTargetNew
File
- src/
Plugin/ DataType/ EntityReferenceRevisions.php, line 66
Class
- EntityReferenceRevisions
- Defines an 'entity_reference_revisions' data type.
Namespace
Drupal\entity_reference_revisions\Plugin\DataTypeCode
public function isTargetNew() {
// If only an ID is given, the reference cannot be a new entity.
return !isset($this->id) && isset($this->target) && $this->target
->getValue()
->isNew();
}