Field types, field widgets and formatters provide various configuration schemas, most of which have been cleaned up and made more extensible.
Field (storage) settings and default values
All field types got their configuration schema names reordered, so the dynamic part is at the end. This allowed us to provide fallback schemas for empty field (storage) settings and default values. It means if your (test) field does not have settings or default values, it does not need to provide schema anymore, the fallback handles that. Core still does provide these schemas to provide custom labels though. Additionally to that, the default value structure is also easier to specify now. Comparisons:
| Before | After |
|---|---|
| field.[field_type].field_settings | field.field_settings.[field_type] |
| field.[field_type].storage_settings | field.storage_settings.[field_type] |
| field.[field_type].value (defined as sequence of mappings) | field.value.[field_type] (now defined as the inner mapping only, the sequence is defined generally not per field type) |
Examples before:
field.entity_reference.storage_settings:
type: mapping
label: 'Entity reference settings'
mapping:
target_type:
type: string
label: 'Type of item to reference'
field.entity_reference.field_settings:
type: mapping
label: 'Entity reference settings'
mapping:
handler:
type: string
label: 'Reference method'
handler_settings:
type: entity_reference.[%parent.handler].handler_settings
label: 'Reference method settings'
field.entity_reference.value:
type: sequence
label: 'Default value'
sequence:
- type: mapping
label: 'Default'
mapping:
target_id:
type: string
label: 'Value'
target_uuid:
type: string
label: 'Target UUID'
Examples after:
field.storage_settings.entity_reference:
type: mapping
label: 'Entity reference settings'
mapping:
target_type:
type: string
label: 'Type of item to reference'
field.field_settings.entity_reference:
type: mapping
label: 'Entity reference settings'
mapping:
handler:
type: string
label: 'Reference method'
handler_settings:
type: entity_reference.[%parent.handler].handler_settings
label: 'Reference method settings'
field.value.entity_reference:
type: mapping
label: 'Default value'
mapping:
target_id:
type: string
label: 'Value'
target_uuid:
type: string
label: 'Target UUID'
Field formatters and widgets
Entity form and view displays now also get a settings key by default for each field type, so no need to define an empty settings schema anymore. Core still defines these to provide better labels for them. Also because formatters and widgets cannot modify the data structure stored outside of their settings, they should only be able to provide schema for their settings, not outer levels of settings storage. The schema was adjusted accordingly. See the comparison and examples:
| Before | After |
|---|---|
| entity_view_display.field.[formatter_name] (defines the container level including formatter settings) | field.formatter.settings.[formatter_name] (only defines the settings level custom to the formatter no outer settings) |
| entity_form_display.field.[widget_name] (defines the container level including widget settings) | field.widget.settings.[widget_name] (only defines settings local to the widget) |
Examples before:
entity_view_display.field.number_integer:
type: entity_field_view_display_base
label: 'Number integer display format settings'
mapping:
settings:
type: mapping
label: 'Settings'
mapping:
thousand_separator:
type: string
label: 'Thousand marker'
prefix_suffix:
type: boolean
label: 'Display prefix and suffix.'
entity_form_display.field.checkbox:
type: entity_field_form_display_base
label: 'Single on/off checkbox format settings'
mapping:
settings:
type: mapping
label: 'Settings'
mapping:
display_label:
type: boolean
label: 'Use field label instead of the "On value" as label'
Examples after:
field.formatter.settings.number_integer:
type: mapping
label: 'Number integer display format settings'
mapping:
thousand_separator:
type: string
label: 'Thousand marker'
prefix_suffix:
type: boolean
label: 'Display prefix and suffix.'
field.widget.settings.checkbox:
type: mapping
label: 'Single on/off checkbox format settings'
mapping:
display_label:
type: boolean
label: 'Use field label instead of the "On value" as label'