EntityReferenceSelection.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace Drupal\Core\Entity\Annotation;
  3. use Drupal\Component\Annotation\Plugin;
  4. /**
  5. * Defines an EntityReferenceSelection plugin annotation object.
  6. *
  7. * Plugin Namespace: Plugin\EntityReferenceSelection
  8. *
  9. * For a working example, see
  10. * \Drupal\comment\Plugin\EntityReferenceSelection\CommentSelection
  11. *
  12. * @see \Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManager
  13. * @see \Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface
  14. * @see plugin_api
  15. *
  16. * @Annotation
  17. */
  18. class EntityReferenceSelection extends Plugin {
  19. /**
  20. * The plugin ID.
  21. *
  22. * @var string
  23. */
  24. public $id;
  25. /**
  26. * The human-readable name of the selection plugin.
  27. *
  28. * @ingroup plugin_translatable
  29. *
  30. * @var \Drupal\Core\Annotation\Translation
  31. */
  32. public $label;
  33. /**
  34. * The selection plugin group.
  35. *
  36. * This property is used to allow selection plugins to target a specific
  37. * entity type while also inheriting the code of an existing selection plugin.
  38. * For example, if we want to override the NodeSelection from the 'default'
  39. * selection type, we can define the annotation of a new plugin as follows:
  40. * @code
  41. * id = "node_advanced",
  42. * entity_types = {"node"},
  43. * group = "default",
  44. * weight = 5
  45. * @endcode
  46. *
  47. * @var string
  48. */
  49. public $group;
  50. /**
  51. * An array of entity types that can be referenced by this plugin. Defaults to
  52. * all entity types.
  53. *
  54. * @var array (optional)
  55. */
  56. public $entity_types = [];
  57. /**
  58. * The weight of the plugin in its group.
  59. *
  60. * @var int
  61. */
  62. public $weight;
  63. }