class EntityType
Same name in this branch
- 9 core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType
- 8.9.x core/lib/Drupal/Core/Entity/Annotation/EntityType.php \Drupal\Core\Entity\Annotation\EntityType
- 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
- 11.x core/lib/Drupal/Core/Entity/EntityType.php \Drupal\Core\Entity\EntityType
- 11.x 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 \Drupal\Component\Annotation\AnnotationInterface
- class \Drupal\Core\Entity\Annotation\EntityType extends \Drupal\Component\Annotation\Plugin uses \Drupal\Core\StringTranslation\StringTranslationTrait
Expanded class hierarchy of EntityType
Related topics
5 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::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.
- EntityStorageBaseTest::testLoadMultiple in core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityStorageBaseTest.php - Test loadMultiple().
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
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | 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. | 2 | |
StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.