Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ContentEntityInterface.php

interface 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

Entity API
Describes how to define and manipulate content and configuration entities.
55 files declare their use of ContentEntityInterface
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
CommentViewsData.php in core/modules/comment/src/CommentViewsData.php

... See full list

1 string reference to 'ContentEntityInterface'
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\Entity
View source
interface ContentEntityInterface extends \Traversable, FieldableEntityInterface, TranslatableRevisionableInterface, SynchronizableInterface {

}
RSS feed
Powered by Drupal