1. 8.2.x core/lib/Drupal/Core/Entity/EntityType.php EntityType
  2. 8.2.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php EntityType
  3. 8.0.x core/lib/Drupal/Core/Entity/EntityType.php EntityType
  4. 8.0.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php EntityType
  5. 8.1.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php EntityType
  6. 8.1.x core/lib/Drupal/Core/Entity/EntityType.php EntityType
  7. 8.3.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php EntityType
  8. 8.3.x core/lib/Drupal/Core/Entity/EntityType.php EntityType

Defines an Entity type annotation object.

Entity type plugins use an object-based annotation method, rather than an array-type annotation method (as commonly used on other annotation types). The annotation properties of entity types are found on \Drupal\Core\Entity\EntityType and are accessed using get/set methods defined in \Drupal\Core\Entity\EntityTypeInterface.


Expanded class hierarchy of EntityType

Related topics

5 string references to 'EntityType'
EntityDataDefinition::getEntityTypeId in core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php
EntityDataDefinition::setEntityTypeId in core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php
EntityReferenceItem::propertyDefinitions in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
Defines field item properties.
EntityTypeConstraintValidatorTest::testValidation in core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php
Tests the EntityTypeConstraintValidator.
TypedDataTest::testTypedDataValidation in core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php
Tests typed data validation.


core/lib/Drupal/Core/Entity/Annotation/EntityType.php, line 21


View source
class EntityType extends Plugin {

  use StringTranslationTrait;

   * The class used to represent the entity type.
   * It must implement \Drupal\Core\Entity\EntityTypeInterface.
   * @var string
  public $entity_type_class = 'Drupal\Core\Entity\EntityType';

   * The group machine name.
  public $group = 'default';

   * The group label.
   * @var \Drupal\Core\Annotation\Translation
   * @ingroup plugin_translatable
  public $group_label = '';

   * {@inheritdoc}
  public function get() {
    $values = $this->definition;

    // Use the specified entity type class, and remove it before instantiating.
    $class = $values['entity_type_class'];

    return new $class($values);



Contains filters are case sensitive
Namesort descending Modifiers Type Description
EntityType::$entity_type_class public property The class used to represent the entity type.
EntityType::$group public property The group machine name.
EntityType::$group_label public property The group label.
EntityType::get public function Gets the value of an annotation. Overrides Plugin::get
Plugin::$definition protected property The plugin definition read from the class annotation.
Plugin::getClass public function Gets the class of the annotated class. Overrides AnnotationInterface::getClass
Plugin::getId public function Gets the unique ID for this annotated class. Overrides AnnotationInterface::getId
Plugin::getProvider public function Gets the name of the provider of the annotated class. Overrides AnnotationInterface::getProvider
Plugin::parse protected function Parses an annotation into its definition.
Plugin::setClass public function Sets the class of the annotated class. Overrides AnnotationInterface::setClass
Plugin::setProvider public function Sets the name of the provider of the annotated class. Overrides AnnotationInterface::setProvider
Plugin::__construct public function Constructs a Plugin object.
StringTranslationTrait::$stringTranslation protected property The string translation service.
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use.
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.