interface ContentEntityInterface
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Entity/ContentEntityInterface.php \Drupal\Core\Entity\ContentEntityInterface
- 10 core/lib/Drupal/Core/Entity/ContentEntityInterface.php \Drupal\Core\Entity\ContentEntityInterface
- 9 core/lib/Drupal/Core/Entity/ContentEntityInterface.php \Drupal\Core\Entity\ContentEntityInterface
- 8.9.x core/lib/Drupal/Core/Entity/ContentEntityInterface.php \Drupal\Core\Entity\ContentEntityInterface
Defines a common interface for all content entity objects.
Content entities use fields for all their entity properties and can be translatable and revisionable. Translations and revisions can be enabled per entity type through annotation and using entity type hooks.
It's best practice to always implement ContentEntityInterface for content-like entities that should be stored in some database, and enable/disable revisions and translations as desired.
When implementing this interface which extends Traversable, make sure to list IteratorAggregate or Iterator before this interface in the implements clause.
Hierarchy
- interface \Drupal\Core\Entity\FieldableEntityInterface extends \Drupal\Core\Entity\EntityInterface; interface \Drupal\Core\Entity\SynchronizableInterface extends \Drupal\Core\Entity\EntityInterface; interface \Drupal\Core\Entity\TranslatableRevisionableInterface extends \Drupal\Core\Entity\TranslatableInterface, \Drupal\Core\Entity\RevisionableInterface
- interface \Drupal\Core\Entity\ContentEntityInterface extends \Drupal\Core\Entity\Traversable, \Drupal\Core\Entity\FieldableEntityInterface, \Drupal\Core\Entity\TranslatableRevisionableInterface, \Drupal\Core\Entity\SynchronizableInterface
Expanded class hierarchy of ContentEntityInterface
All classes that implement ContentEntityInterface
See also
\Drupal\Core\Entity\ContentEntityBase
\Drupal\Core\Entity\EntityTypeInterface
Related topics
85 files declare their use of ContentEntityInterface
- BatchUserAction.php in core/
modules/ views/ tests/ modules/ user_batch_action_test/ src/ Plugin/ Action/ BatchUserAction.php - BlockContentInterface.php in core/
modules/ block_content/ src/ BlockContentInterface.php - BlockContentModerationHandler.php in core/
modules/ content_moderation/ src/ Entity/ Handler/ BlockContentModerationHandler.php - CommentInterface.php in core/
modules/ comment/ src/ CommentInterface.php - CommentTokensHooks.php in core/
modules/ comment/ src/ Hook/ CommentTokensHooks.php
2 string references to 'ContentEntityInterface'
- core.entity.schema.yml in core/
config/ schema/ core.entity.schema.yml - core/config/schema/core.entity.schema.yml
- language.schema.yml in core/
modules/ language/ config/ schema/ language.schema.yml - core/modules/language/config/schema/language.schema.yml
File
-
core/
lib/ Drupal/ Core/ Entity/ ContentEntityInterface.php, line 24
Namespace
Drupal\Core\EntityView source
interface ContentEntityInterface extends \Traversable, FieldableEntityInterface, TranslatableRevisionableInterface, SynchronizableInterface {
/**
* Gets the bundle entity of this entity.
*
* @return \Drupal\Core\Entity\EntityInterface|null
* The entity which is the bundle of this entity, or NULL if this entity's
* entity type does not represent bundles with an entity.
*/
public function getBundleEntity() : ?EntityInterface;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.