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