1. 8.3.x core/lib/Drupal/Core/Entity/EntityType.php EntityType
  2. 8.3.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php EntityType
  3. 8.0.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php EntityType
  4. 8.0.x core/lib/Drupal/Core/Entity/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.2.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php EntityType
  8. 8.2.x core/lib/Drupal/Core/Entity/EntityType.php EntityType
  9. 8.4.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php EntityType
  10. 8.4.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.

Hierarchy

Expanded class hierarchy of EntityType

Related topics

5 string references to 'EntityType'
EntityDataDefinition::getEntityTypeId in core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php
Gets the entity type ID.
EntityDataDefinition::setEntityTypeId in core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php
Sets the entity type ID.
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.

File

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

Namespace

Drupal\Core\Entity\Annotation
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'];
    unset($values['entity_type_class']);

    return new $class($values);
  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description Overrides
EntityType::$entity_type_class public property The class used to represent the entity type. 2
EntityType::$group public property The group machine name. 2
EntityType::$group_label public property The group label.
EntityType::get public function Gets the value of an annotation. Overrides Plugin::get 2
Plugin::$definition protected property The plugin definition read from the class annotation. 1
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 1
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. 2
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. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language. 2