interface ContentEntityInterface

Same name 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

  • 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

72 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
comment.tokens.inc in core/modules/comment/comment.tokens.inc
Builds placeholder replacement tokens for comment-related data.
comment.views.inc in core/modules/comment/comment.views.inc
Provide views data for comment.module.

... 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.