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

Namespace

Drupal\Core\Entity\Annotation

File

core/lib/Drupal/Core/Entity/Annotation/EntityType.php
View source
  1. <?php
  2. namespace Drupal\Core\Entity\Annotation;
  3. use Drupal\Component\Annotation\Plugin;
  4. use Drupal\Core\StringTranslation\StringTranslationTrait;
  5. /**
  6. * Defines an Entity type annotation object.
  7. *
  8. * Entity type plugins use an object-based annotation method, rather than an
  9. * array-type annotation method (as commonly used on other annotation types).
  10. * The annotation properties of entity types are found on
  11. * \Drupal\Core\Entity\EntityType and are accessed using get/set methods defined
  12. * in \Drupal\Core\Entity\EntityTypeInterface.
  13. *
  14. * @ingroup entity_api
  15. *
  16. * @Annotation
  17. */
  18. class EntityType extends Plugin {
  19. use StringTranslationTrait;
  20. /**
  21. * The class used to represent the entity type.
  22. *
  23. * It must implement \Drupal\Core\Entity\EntityTypeInterface.
  24. *
  25. * @var string
  26. */
  27. public $entity_type_class = 'Drupal\Core\Entity\EntityType';
  28. /**
  29. * The group machine name.
  30. */
  31. public $group = 'default';
  32. /**
  33. * The group label.
  34. *
  35. * @var \Drupal\Core\Annotation\Translation
  36. *
  37. * @ingroup plugin_translatable
  38. */
  39. public $group_label = '';
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function get() {
  44. $values = $this->definition;
  45. // Use the specified entity type class, and remove it before instantiating.
  46. $class = $values['entity_type_class'];
  47. unset($values['entity_type_class']);
  48. return new $class($values);
  49. }
  50. }

Classes

Namesort descending Description
EntityType Defines an Entity type annotation object.