FieldType.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. namespace Drupal\Core\Field\Annotation;
  3. use Drupal\Core\TypedData\Annotation\DataType;
  4. /**
  5. * Defines a FieldType annotation object.
  6. *
  7. * Additional annotation keys for field types can be defined in
  8. * hook_field_info_alter().
  9. *
  10. * @ingroup field_types
  11. *
  12. * @Annotation
  13. */
  14. class FieldType extends DataType {
  15. /**
  16. * The plugin ID.
  17. *
  18. * @var string
  19. */
  20. public $id;
  21. /**
  22. * The name of the module providing the field type plugin.
  23. *
  24. * @var string
  25. */
  26. public $module;
  27. /**
  28. * The human-readable name of the field type.
  29. *
  30. * @ingroup plugin_translatable
  31. *
  32. * @var \Drupal\Core\Annotation\Translation
  33. */
  34. public $label;
  35. /**
  36. * A short human readable description for the field type.
  37. *
  38. * @ingroup plugin_translatable
  39. *
  40. * @var \Drupal\Core\Annotation\Translation
  41. */
  42. public $description;
  43. /**
  44. * The category under which the field type should be listed in the UI.
  45. *
  46. * @ingroup plugin_translatable
  47. *
  48. * @var \Drupal\Core\Annotation\Translation
  49. */
  50. public $category = '';
  51. /**
  52. * The plugin_id of the default widget for this field type.
  53. *
  54. * This widget must be available whenever the field type is available (i.e.
  55. * provided by the field type module, or by a module the field type module
  56. * depends on).
  57. *
  58. * @var string
  59. */
  60. public $default_widget;
  61. /**
  62. * The plugin_id of the default formatter for this field type.
  63. *
  64. * This formatter must be available whenever the field type is available (i.e.
  65. * provided by the field type module, or by a module the field type module
  66. * depends on).
  67. *
  68. * @var string
  69. */
  70. public $default_formatter;
  71. /**
  72. * A boolean stating that fields of this type cannot be created through the UI.
  73. *
  74. * @var bool
  75. */
  76. public $no_ui = FALSE;
  77. /**
  78. * {@inheritdoc}
  79. */
  80. public $list_class;
  81. /**
  82. * An integer defining a fixed cardinality for this field type.
  83. *
  84. * If this value is not set, cardinality can be configured in the field UI.
  85. *
  86. * @var int|null
  87. */
  88. public $cardinality;
  89. }