Commit 7a98471c authored by alexpott's avatar alexpott

Issue #2273631 by vijaycs85: Unify config entity schemas with a base schema type.

parent beca96c5
...@@ -231,3 +231,25 @@ config_dependencies: ...@@ -231,3 +231,25 @@ config_dependencies:
label: 'Theme dependencies' label: 'Theme dependencies'
sequence: sequence:
- type: string - type: string
config_entity:
type: mapping
mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
label:
type: label
label: 'Label'
langcode:
type: string
label: 'Default language'
status:
type: boolean
label: 'Status'
dependencies:
type: config_dependencies
label: 'Dependencies'
# Schema for the configuration files of the Block module. # Schema for the configuration files of the Block module.
block.block.*: block.block.*:
type: mapping type: config_entity
label: 'Block' label: 'Block'
mapping: mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
theme: theme:
type: string type: string
label: 'Theme' label: 'Theme'
...@@ -22,9 +16,6 @@ block.block.*: ...@@ -22,9 +16,6 @@ block.block.*:
provider: provider:
type: string type: string
label: 'Provider' label: 'Provider'
status:
type: boolean
label: 'Status'
visibility: visibility:
type: mapping type: mapping
label: 'Visibility settings' label: 'Visibility settings'
...@@ -97,9 +88,3 @@ block.block.*: ...@@ -97,9 +88,3 @@ block.block.*:
provider: provider:
type: string type: string
label: 'Provider' label: 'Provider'
langcode:
type: string
label: 'Default language'
dependencies:
type: config_dependencies
label: 'Dependencies'
# Schema for the configuration files of the Custom Block module. # Schema for the configuration files of the Custom Block module.
custom_block.type.*: custom_block.type.*:
type: mapping type: config_entity
label: 'Custom block type settings' label: 'Custom block type settings'
mapping: mapping:
id:
type: string
label: 'Machine-readable name'
uuid:
type: string
label: 'UUID'
label:
type: label
label: 'Label'
revision: revision:
type: integer type: integer
label: 'Create new revision' label: 'Create new revision'
description: description:
type: text type: text
label: 'Description' label: 'Description'
status:
type: boolean
label: 'Status'
langcode:
type: string
label: 'Default language'
# Schema for the configuration files of the Breakpoint module. # Schema for the configuration files of the Breakpoint module.
breakpoint.breakpoint.*.*.*: breakpoint.breakpoint.*.*.*:
type: mapping type: config_entity
label: 'Defines the Breakpoint entity' label: 'Defines the Breakpoint entity'
mapping: mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
name: name:
type: string type: string
label: 'Machine name' label: 'Machine name'
label:
type: string
label: 'Label'
mediaQuery: mediaQuery:
type: string type: string
label: 'Media query' label: 'Media query'
...@@ -33,32 +24,14 @@ breakpoint.breakpoint.*.*.*: ...@@ -33,32 +24,14 @@ breakpoint.breakpoint.*.*.*:
sequence: sequence:
- type: string - type: string
label: 'Multiplier' label: 'Multiplier'
langcode:
type: string
label: 'Default language'
status:
type: boolean
label: 'Enabled'
dependencies:
type: config_dependencies
label: 'Dependencies'
breakpoint.breakpoint_group.*.*.*: breakpoint.breakpoint_group.*.*.*:
type: mapping type: config_entity
label: 'Breakpoint group settings' label: 'Breakpoint group settings'
mapping: mapping:
id:
type: string
label: 'Group ID'
uuid:
type: string
label: 'UUID'
name: name:
type: string type: string
label: 'Machine name' label: 'Machine name'
label:
type: string
label: 'Label'
breakpoint_ids: breakpoint_ids:
type: sequence type: sequence
label: 'Breakpoints' label: 'Breakpoints'
...@@ -71,12 +44,3 @@ breakpoint.breakpoint_group.*.*.*: ...@@ -71,12 +44,3 @@ breakpoint.breakpoint_group.*.*.*:
sourceType: sourceType:
type: string type: string
label: 'Group source type' label: 'Group source type'
langcode:
type: string
label: 'Default language'
status:
type: boolean
label: 'Enabled'
dependencies:
type: config_dependencies
label: 'Dependencies'
...@@ -135,21 +135,27 @@ function testSchemaMapping() { ...@@ -135,21 +135,27 @@ function testSchemaMapping() {
$expected['label'] = 'Image style'; $expected['label'] = 'Image style';
$expected['class'] = '\Drupal\Core\Config\Schema\Mapping'; $expected['class'] = '\Drupal\Core\Config\Schema\Mapping';
$expected['mapping']['name']['type'] = 'string'; $expected['mapping']['name']['type'] = 'string';
$expected['mapping']['uuid']['label'] = 'UUID'; $expected['mapping']['id']['label'] = 'ID';
$expected['mapping']['id']['type'] = 'string';
$expected['mapping']['uuid']['type'] = 'string'; $expected['mapping']['uuid']['type'] = 'string';
$expected['mapping']['uuid']['label'] = 'UUID';
$expected['mapping']['label']['type'] = 'label'; $expected['mapping']['label']['type'] = 'label';
$expected['mapping']['label']['label'] = 'Label';
$expected['mapping']['langcode']['type'] = 'string';
$expected['mapping']['langcode']['label'] = 'Default language';
$expected['mapping']['status']['type'] = 'boolean';
$expected['mapping']['status']['label'] = 'Status';
$expected['mapping']['dependencies']['type'] = 'config_dependencies';
$expected['mapping']['dependencies']['label'] = 'Dependencies';
$expected['mapping']['name']['type'] = 'string';
$expected['mapping']['effects']['type'] = 'sequence'; $expected['mapping']['effects']['type'] = 'sequence';
$expected['mapping']['effects']['sequence'][0]['type'] = 'mapping'; $expected['mapping']['effects']['sequence'][0]['type'] = 'mapping';
$expected['mapping']['effects']['sequence'][0]['mapping']['id']['type'] = 'string'; $expected['mapping']['effects']['sequence'][0]['mapping']['id']['type'] = 'string';
$expected['mapping']['effects']['sequence'][0]['mapping']['data']['type'] = 'image.effect.[%parent.id]'; $expected['mapping']['effects']['sequence'][0]['mapping']['data']['type'] = 'image.effect.[%parent.id]';
$expected['mapping']['effects']['sequence'][0]['mapping']['weight']['type'] = 'integer'; $expected['mapping']['effects']['sequence'][0]['mapping']['weight']['type'] = 'integer';
$expected['mapping']['effects']['sequence'][0]['mapping']['uuid']['type'] = 'string'; $expected['mapping']['effects']['sequence'][0]['mapping']['uuid']['type'] = 'string';
$expected['mapping']['langcode']['label'] = 'Default language';
$expected['mapping']['langcode']['type'] = 'string';
$expected['mapping']['status']['label'] = 'Enabled';
$expected['mapping']['status']['type'] = 'boolean';
$this->assertEqual($definition, $expected, 'Retrieved the right metadata for image.style.large'); $this->assertEqual($definition, $expected);
// More complex, type based on a complex one. // More complex, type based on a complex one.
$definition = \Drupal::service('config.typed')->getDefinition('image.effect.image_scale'); $definition = \Drupal::service('config.typed')->getDefinition('image.effect.image_scale');
......
...@@ -21,29 +21,14 @@ config_test.dynamic.*: ...@@ -21,29 +21,14 @@ config_test.dynamic.*:
label: 'Protected property' label: 'Protected property'
config_test_dynamic: config_test_dynamic:
type: mapping type: config_entity
mapping: mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
label:
type: label
label: 'Label'
weight: weight:
type: integer type: integer
label: 'Weight' label: 'Weight'
style: style:
type: string type: string
label: 'style' label: 'style'
status:
type: boolean
label: 'Status'
langcode:
type: string
label: 'Default language'
protected_property: protected_property:
type: string type: string
label: 'Protected property' label: 'Protected property'
......
# Schema for the configuration files of the Contact module. # Schema for the configuration files of the Contact module.
contact.category.*: contact.category.*:
type: mapping type: config_entity
label: 'Contact category' label: 'Contact category'
mapping: mapping:
id:
type: string
label: 'Category identifier'
uuid:
type: string
label: 'UUID'
label:
type: label
label: 'Label'
recipients: recipients:
type: sequence type: sequence
label: 'Recipients' label: 'Recipients'
...@@ -25,12 +16,6 @@ contact.category.*: ...@@ -25,12 +16,6 @@ contact.category.*:
weight: weight:
type: integer type: integer
label: 'Weight' label: 'Weight'
status:
type: boolean
label: 'Status'
langcode:
type: string
label: 'Default language'
contact.settings: contact.settings:
type: mapping type: mapping
......
# Schema for the configuration files of the Editor module. # Schema for the configuration files of the Editor module.
editor.editor.*: editor.editor.*:
type: mapping type: config_entity
label: 'Text editor' label: 'Text editor'
mapping: mapping:
format: format:
...@@ -38,12 +38,3 @@ editor.editor.*: ...@@ -38,12 +38,3 @@ editor.editor.*:
height: height:
type: integer type: integer
label: 'Maximum height' label: 'Maximum height'
status:
type: boolean
label: 'Status'
langcode:
type: string
label: 'Default language'
dependencies:
type: config_dependencies
label: 'Dependencies'
...@@ -30,45 +30,21 @@ entity.view_mode.*.*: ...@@ -30,45 +30,21 @@ entity.view_mode.*.*:
label: 'Dependencies' label: 'Dependencies'
entity.form_mode.*.*: entity.form_mode.*.*:
type: mapping type: config_entity
label: 'Entity form mode settings' label: 'Entity form mode settings'
mapping: mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
label:
type: label
label: 'The human-readable name of the form mode'
targetEntityType: targetEntityType:
type: string type: string
label: 'Target entity type' label: 'Target entity type'
status:
type: boolean
label: 'Enabled'
cache: cache:
type: boolean type: boolean
label: 'Cache' label: 'Cache'
langcode:
type: string
label: 'Default language'
dependencies:
type: config_dependencies
label: 'Dependencies'
# Overview configuration information for view mode or form mode displays. # Overview configuration information for view mode or form mode displays.
entity.view_display.*.*.*: entity.view_display.*.*.*:
type: mapping type: config_entity
label: 'Entity display' label: 'Entity display'
mapping: mapping:
id:
type: string
label: 'Entity display ID'
uuid:
type: string
label: 'UUID'
targetEntityType: targetEntityType:
type: string type: string
label: 'Target entity type' label: 'Target entity type'
...@@ -78,9 +54,6 @@ entity.view_display.*.*.*: ...@@ -78,9 +54,6 @@ entity.view_display.*.*.*:
mode: mode:
type: string type: string
label: 'View or form mode machine name' label: 'View or form mode machine name'
status:
type: boolean
label: 'Enabled'
content: content:
type: sequence type: sequence
label: 'Field display formatters' label: 'Field display formatters'
...@@ -92,21 +65,12 @@ entity.view_display.*.*.*: ...@@ -92,21 +65,12 @@ entity.view_display.*.*.*:
sequence: sequence:
- type: boolean - type: boolean
label: 'Value' label: 'Value'
dependencies:
type: config_dependencies
label: 'Dependencies'
# Overview configuration information for form mode displays. # Overview configuration information for form mode displays.
entity.form_display.*.*.*: entity.form_display.*.*.*:
type: mapping type: config_entity
label: 'Entity form display' label: 'Entity form display'
mapping: mapping:
id:
type: string
label: 'Entity display ID'
uuid:
type: string
label: 'UUID'
targetEntityType: targetEntityType:
type: string type: string
label: 'Target entity type' label: 'Target entity type'
...@@ -121,12 +85,6 @@ entity.form_display.*.*.*: ...@@ -121,12 +85,6 @@ entity.form_display.*.*.*:
label: 'Field form display formatters' label: 'Field form display formatters'
sequence: sequence:
- type: entity_form_display.field.[type] - type: entity_form_display.field.[type]
status:
type: boolean
label: 'Enabled'
dependencies:
type: config_dependencies
label: 'Dependencies'
hidden: hidden:
type: sequence type: sequence
label: 'Hidden' label: 'Hidden'
......
...@@ -9,21 +9,9 @@ field.settings: ...@@ -9,21 +9,9 @@ field.settings:
label: 'Maximum number of field data records to purge' label: 'Maximum number of field data records to purge'
field.field.*.*: field.field.*.*:
type: mapping type: config_entity
label: 'Field' label: 'Field'
mapping: mapping:
id:
type: string
label: 'Machine name'
uuid:
type: string
label: 'UUID'
status:
type: boolean
label: 'Status'
langcode:
type: string
label: 'Default language'
name: name:
type: string type: string
label: 'Name' label: 'Name'
...@@ -56,26 +44,11 @@ field.field.*.*: ...@@ -56,26 +44,11 @@ field.field.*.*:
sequence: sequence:
- type: string - type: string
label: 'Column' label: 'Column'
dependencies:
type: config_dependencies
label: 'Dependencies'
field.instance.*.*.*: field.instance.*.*.*:
type: mapping type: config_entity
label: 'Field instance' label: 'Field instance'
mapping: mapping:
id:
type: string
label: 'ID'
uuid:
type: string
label: 'UUID'
status:
type: boolean
label: 'Status'
langcode:
type: string
label: 'Default language'
field_uuid: field_uuid:
type: string type: string
label: 'Field UUID' label: 'Field UUID'
...@@ -88,9 +61,6 @@ field.instance.*.*.*: ...@@ -88,9 +61,6 @@ field.instance.*.*.*:
bundle: bundle:
type: string type: string
label: 'Bundle' label: 'Bundle'
label:
type: label
label: 'Label'
description: description:
type: text type: text
label: 'Help text' label: 'Help text'
...@@ -107,9 +77,6 @@ field.instance.*.*.*: ...@@ -107,9 +77,6 @@ field.instance.*.*.*:
field_type: field_type:
type: string type: string
label: 'Field type' label: 'Field type'
dependencies:
type: config_dependencies
label: 'Dependencies'
entity_form_display.field.hidden: entity_form_display.field.hidden:
type: entity_field_form_display_base type: entity_field_form_display_base
......
...@@ -12,21 +12,15 @@ filter.settings: ...@@ -12,21 +12,15 @@ filter.settings:
label: 'Always show fallback choice' label: 'Always show fallback choice'
filter.format.*: filter.format.*:
type: mapping type: config_entity
label: 'Text formats' label: 'Text formats'
mapping: mapping:
format:
type: string
label: 'Machine name'
name: name:
type: label type: label
label: 'Name' label: 'Name'
uuid: format:
type: string type: string
label: 'UUID' label: 'Machine name'
status:
type: boolean
label: 'Enabled'
weight: weight:
type: integer type: integer
label: 'Weight' label: 'Weight'
...@@ -44,9 +38,6 @@ filter.format.*: ...@@ -44,9 +38,6 @@ filter.format.*:
label: 'Enabled filters' label: 'Enabled filters'
sequence: