interface ContentEntityInterface

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityInterface.php \Drupal\Core\Entity\ContentEntityInterface
  2. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityInterface.php \Drupal\Core\Entity\ContentEntityInterface
  3. 11.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

Expanded class hierarchy of ContentEntityInterface

All classes that implement ContentEntityInterface

See also

\Drupal\Core\Entity\ContentEntityBase

\Drupal\Core\Entity\EntityTypeInterface

Related topics

69 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
CommentViewsData.php in core/modules/comment/src/CommentViewsData.php

... See full list

File

core/lib/Drupal/Core/Entity/ContentEntityInterface.php, line 24

Namespace

Drupal\Core\Entity
View source
interface ContentEntityInterface extends \Traversable, FieldableEntityInterface, TranslatableRevisionableInterface, SynchronizableInterface {

}

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