diff --git a/core/lib/Drupal/Core/Entity/ContentEntityInterface.php b/core/lib/Drupal/Core/Entity/ContentEntityInterface.php index f43bc3b453d2d42537bba2abf83146f133dbc104..9a7858db9bc1078b2c92fe913cf1ed94d8a28657 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityInterface.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityInterface.php @@ -5,16 +5,19 @@ /** * Defines a common interface for all content entity objects. * - * Content entities use fields for all their entity properties and are - * translatable and revisionable, while translations and revisions can be - * enabled per entity type. 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. + * 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. * * @see \Drupal\Core\Entity\ContentEntityBase + * @see \Drupal\Core\Entity\EntityTypeInterface * * @ingroup entity_api */ diff --git a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php index 973ca0114f7ff2f06ee6153fb847f8cf305202e1..b2c1f5d20edae0e66f95426644d2d5bcd248d1ae 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php @@ -7,10 +7,19 @@ /** * Provides an interface for an entity type and its metadata. * - * Additional information can be provided by modules: hook_entity_type_build() can be - * implemented to define new properties, while hook_entity_type_alter() can be - * implemented to alter existing data and fill-in defaults. Module-specific - * properties should be documented in the hook implementations defining them. + * Entity type classes can provide docblock annotations. The entity type manager + * will use these annotations to populate the entity type object with + * properties. + * + * Additional properties can be defined by module implementations of + * hook_entity_type_build(). Existing data can be altered in implementations of + * hook_entity_type_alter(), which can also be used to fill in defaults. + * Module-specific properties should be documented in the hook implementations + * defining them. + * + * @see \Drupal\Core\Entity\EntityTypeManagerInterface + * @see hook_entity_type_build() + * @see hook_entity_type_alter() */ interface EntityTypeInterface extends PluginDefinitionInterface { diff --git a/core/lib/Drupal/Core/Entity/RevisionableInterface.php b/core/lib/Drupal/Core/Entity/RevisionableInterface.php index 0fc6db2fec9359a310bc6bf3d9bff5da58a42174..6dfc9ed3a0930e000fdaca36d35c028f1a018d72 100644 --- a/core/lib/Drupal/Core/Entity/RevisionableInterface.php +++ b/core/lib/Drupal/Core/Entity/RevisionableInterface.php @@ -4,6 +4,21 @@ /** * Provides methods for an entity to support revisions. + * + * Classes implementing this interface do not necessarily support revisions. + * + * To detect whether an entity type supports revisions, call + * EntityTypeInterface::isRevisionable(). + * + * Many entity interfaces are composed of numerous other interfaces such as this + * one, which allow implementations to pick and choose which features to. + * support through stub implementations of various interface methods. This means + * that even if an entity class implements RevisionableInterface, it might only + * have a stub implementation and not a functional one. + * + * @see \Drupal\Core\Entity\EntityTypeInterface::isRevisionable() + * @see https://www.drupal.org/docs/8/api/entity-api/structure-of-an-entity-annotation + * @see https://www.drupal.org/docs/8/api/entity-api/making-an-entity-revisionable */ interface RevisionableInterface { diff --git a/core/lib/Drupal/Core/TypedData/TranslatableInterface.php b/core/lib/Drupal/Core/TypedData/TranslatableInterface.php index 76a9f9556af56667353649c958ccaeec830683be..4dabef12f0e93c83b0ba6e4fb588e3f0ee018440 100644 --- a/core/lib/Drupal/Core/TypedData/TranslatableInterface.php +++ b/core/lib/Drupal/Core/TypedData/TranslatableInterface.php @@ -4,6 +4,21 @@ /** * Interface for translatable data. + * + * Classes implementing this interface do not necessarily support translations. + * + * To detect whether an entity type supports translation, call + * EntityTypeInterface::isTranslatable(). + * + * Many entity interfaces are composed of numerous other interfaces such as this + * one, which allow implementations to pick and choose which features to support + * through stub implementations of various interface methods. This means that + * even if an entity class implements TranslatableInterface, it might only have + * a stub implementation and not a functional one. + * + * @see \Drupal\Core\Entity\EntityTypeInterface::isTranslatable() + * @see https://www.drupal.org/docs/8/api/entity-api/structure-of-an-entity-annotation + * @see https://www.drupal.org/docs/8/api/entity-api/entity-translation-api */ interface TranslatableInterface {