You are here

interface ContentEntityInterface in Drupal 10

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

68 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 {

}

Members