Same name in this branch
  1. 10 core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType
  2. 10 core/lib/Drupal/Core/Entity/Annotation/EntityType.php \Drupal\Core\Entity\Annotation\EntityType
Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php \Drupal\Core\Entity\Annotation\EntityType
  2. 9 core/lib/Drupal/Core/Entity/Annotation/EntityType.php \Drupal\Core\Entity\Annotation\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

6 string references to 'EntityType'
EntityContextDefinition::getConstraintObjects in core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php
Extracts an array of constraints for a context definition object.
EntityContextDefinitionIsSatisfiedTest::providerTestIsSatisfiedBy in core/tests/Drupal/Tests/Core/Plugin/Context/EntityContextDefinitionIsSatisfiedTest.php
Provides test data for ::testIsSatisfiedBy().
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.
EntityTypeConstraintValidatorTest::testValidation in core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php
Tests the EntityTypeConstraintValidator.

... See full list

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.
   *
   * @var string
   */
  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

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 1
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 1
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. 3
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
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. 1
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.