public function Entity::isNew in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Entity/Entity.php \Drupal\Core\Entity\Entity::isNew()
Determines whether the entity is new.
Usually an entity is new if no ID exists for it yet. However, entities may be enforced to be new with existing IDs too.
Return value
bool TRUE if the entity is new, or FALSE if the entity has already been saved.
Overrides EntityInterface::isNew
See also
\Drupal\Core\Entity\EntityInterface::enforceIsNew()
4 calls to Entity::isNew()
- Comment::preSave in core/
modules/ comment/ src/ Entity/ Comment.php - Acts on an entity before the presave hook is invoked.
- ContentEntityBase::hasTranslationChanges in core/
lib/ Drupal/ Core/ Entity/ ContentEntityBase.php - Determines if the current translation of the entity has unsaved changes.
- Entity::delete in core/
lib/ Drupal/ Core/ Entity/ Entity.php - Deletes an entity permanently.
- Entity::getCacheTagsToInvalidate in core/
lib/ Drupal/ Core/ Entity/ Entity.php - Returns the cache tags that should be used to invalidate caches.
2 methods override Entity::isNew()
- ConfigEntityBase::isNew in core/
lib/ Drupal/ Core/ Config/ Entity/ ConfigEntityBase.php - Overrides Entity::isNew().
- User::isNew in core/
modules/ user/ src/ Entity/ User.php - Determines whether the entity is new.
File
- core/
lib/ Drupal/ Core/ Entity/ Entity.php, line 130 - Contains \Drupal\Core\Entity\Entity.
Class
- Entity
- Defines a base entity class.
Namespace
Drupal\Core\EntityCode
public function isNew() {
return !empty($this->enforceIsNew) || !$this
->id();
}