FieldWidget.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace Drupal\Core\Field\Annotation;
  3. use Drupal\Component\Annotation\Plugin;
  4. /**
  5. * Defines a FieldWidget annotation object.
  6. *
  7. * Widgets handle how fields are displayed in edit forms.
  8. *
  9. * Additional annotation keys for widgets can be defined in
  10. * hook_field_widget_info_alter().
  11. *
  12. * @Annotation
  13. *
  14. * @see \Drupal\Core\Field\WidgetPluginManager
  15. * @see \Drupal\Core\Field\WidgetInterface
  16. *
  17. * @ingroup field_widget
  18. */
  19. class FieldWidget extends Plugin {
  20. /**
  21. * The plugin ID.
  22. *
  23. * @var string
  24. */
  25. public $id;
  26. /**
  27. * The human-readable name of the widget type.
  28. *
  29. * @ingroup plugin_translatable
  30. *
  31. * @var \Drupal\Core\Annotation\Translation
  32. */
  33. public $label;
  34. /**
  35. * A short description of the widget type.
  36. *
  37. * @ingroup plugin_translatable
  38. *
  39. * @var \Drupal\Core\Annotation\Translation
  40. */
  41. public $description;
  42. /**
  43. * The name of the widget class.
  44. *
  45. * This is not provided manually, it will be added by the discovery mechanism.
  46. *
  47. * @var string
  48. */
  49. public $class;
  50. /**
  51. * An array of field types the widget supports.
  52. *
  53. * @var array
  54. */
  55. public $field_types = [];
  56. /**
  57. * Does the field widget handles multiple values at once.
  58. *
  59. * @var bool
  60. */
  61. public $multiple_values = FALSE;
  62. /**
  63. * An integer to determine the weight of this widget relative to other widgets
  64. * in the Field UI when selecting a widget for a given field.
  65. *
  66. * @var int optional
  67. */
  68. public $weight = NULL;
  69. }