PreconfiguredFieldUiOptionsInterface.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace Drupal\Core\Field;
  3. /**
  4. * Defines an interface for exposing "preconfigured" field definitions.
  5. *
  6. * These field definitions will be exposed as additional options in the 'Add
  7. * field' form in Field UI, together with individual field types.
  8. *
  9. * @see \Drupal\Core\Field\FieldTypePluginManager::getUiDefinitions()
  10. * @see \Drupal\field_ui\Form\FieldStorageAddForm::submitForm()
  11. */
  12. interface PreconfiguredFieldUiOptionsInterface {
  13. /**
  14. * Returns preconfigured field options for a field type.
  15. *
  16. * Note that if you want to give modules an opportunity to alter the result
  17. * of this method, you should call
  18. * \Drupal\Core\Field\FieldTypePluginManagerInterface::getPreconfiguredOptions()
  19. * instead.
  20. *
  21. * @return mixed[][]
  22. * A multi-dimensional array with string keys and the following structure:
  23. * - label: The label to show in the field type selection list.
  24. * - category: (optional) The category in which to put the field label.
  25. * Defaults to the category of the field type.
  26. * - field_storage_config: An array with the following supported keys:
  27. * - cardinality: The field cardinality.
  28. * - settings: Field-type specific storage settings.
  29. * - field_config: An array with the following supported keys:
  30. * - required: Indicates whether the field is required.
  31. * - settings: Field-type specific settings.
  32. * - entity_form_display: An array with the following supported keys:
  33. * - type: The widget to be used in the 'default' form mode.
  34. * - entity_view_display: An array with the following supported keys:
  35. * - type: The formatter to be used in the 'default' view mode.
  36. *
  37. * @see \Drupal\field\Entity\FieldStorageConfig
  38. * @see \Drupal\field\Entity\FieldConfig
  39. * @see \Drupal\Core\Entity\Display\EntityDisplayInterface::setComponent()
  40. * @see \Drupal\Core\Field\FieldTypePluginManagerInterface::getPreconfiguredOptions()
  41. */
  42. public static function getPreconfiguredOptions();
  43. }