Same name in this branch
- 10 core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType
- 10 core/lib/Drupal/Core/Entity/Annotation/EntityType.php \Drupal\Core\Entity\Annotation\EntityType
Same name and namespace in other branches
- 8.9.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php \Drupal\Core\Entity\Annotation\EntityType
- 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
- class \Drupal\Component\Annotation\Plugin implements AnnotationInterface
- class \Drupal\Core\Entity\Annotation\EntityType uses StringTranslationTrait
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.
File
- core/
lib/ Drupal/ Core/ Entity/ Annotation/ EntityType.php, line 21
Namespace
Drupal\Core\Entity\AnnotationView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Plugin:: |
public | function | Constructs a Plugin object. | 3 |
StringTranslationTrait:: |
protected | property | The string translation service. | 3 |
EntityType:: |
public | function |
Gets the value of an annotation. Overrides Plugin:: |
2 |
EntityType:: |
public | property | The class used to represent the entity type. | 2 |
EntityType:: |
public | property | The group machine name. | 2 |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 1 |
Plugin:: |
public | function |
Gets the name of the provider of the annotated class. Overrides AnnotationInterface:: |
1 |
Plugin:: |
public | function |
Gets the class of the annotated class. Overrides AnnotationInterface:: |
1 |
Plugin:: |
public | function |
Sets the class of the annotated class. Overrides AnnotationInterface:: |
1 |
Plugin:: |
protected | property | The plugin definition read from the class annotation. | 1 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
Plugin:: |
protected | function | Parses an annotation into its definition. | |
Plugin:: |
public | function |
Sets the name of the provider of the annotated class. Overrides AnnotationInterface:: |
|
Plugin:: |
public | function |
Gets the unique ID for this annotated class. Overrides AnnotationInterface:: |
|
EntityType:: |
public | property | The group label. |