diff --git a/core/modules/field/config/schema/field.schema.yml b/core/modules/field/config/schema/field.schema.yml index b9e51d6..2f65293 100644 --- a/core/modules/field/config/schema/field.schema.yml +++ b/core/modules/field/config/schema/field.schema.yml @@ -7,3 +7,125 @@ field.settings: purge_batch_size: type: integer label: 'Maximum number of field data records to purge' + +field.field.*: + type: mapping + label: 'Field' + mapping: + id: + type: string + label: 'Machine name' + uuid: + type: string + label: 'UUID' + status: + type: boolean + label: 'Status' + langcode: + type: string + label: 'Default language' + type: + type: string + label: 'Type' + settings: + type: field.settings.[%parent.type] + module: + type: string + label: 'Module' + active: + type: boolean + label: 'Active' + entity_types: + type: sequence + label: 'Entity types' + sequence: + - type: string + label: 'Entity type' + storage: + type: mapping + label: 'Storage' + mapping: + type: + type: string + label: 'Type' + settings: + type: field.storage.[%parent.type].settings + module: + type: string + label: 'Module' + active: + type: boolean + label: 'Active' + locked: + type: boolean + label: 'Locked' + cardinality: + type: integer + label: 'Maximum number of values users can enter' + translatable: + type: boolean + label: 'Translatable' + indexes: + type: field.index.[%parent.type] + label: 'Indexes' + sequence: + - type: string + label: 'Index' + +field.instance.*.*.*: + type: mapping + label: 'Field instance settings' + mapping: + id: + type: string + label: 'Machine name' + uuid: + type: string + label: 'UUID' + status: + type: boolean + label: 'Status' + langcode: + type: string + label: 'Default language' + field_uuid: + type: string + label: 'Field UUID' + entity_type: + type: string + label: 'Entity type' + bundle: + type: string + label: 'Bundle' + label: + type: label + label: 'Label' + description: + type: text + label: 'Help text' + required: + type: boolean + label: 'Required field' + default_value: + type: field_instance.[%parent.widget.type].default + default_value_function: + type: string + label: 'Default value funtion' + settings: + type: field_instance.[%parent.widget.type].settings + widget: + type: mapping + label: 'Widget settings' + mapping: + weight: + type: integer + label: 'Weight' + type: + type: string + label: 'Widget type' + settings: + type: field_instance.[%parent.type].widget.settings + module: + type: string + label: 'Module' + diff --git a/core/modules/field/field.install b/core/modules/field/field.install index c1a1378..810e786 100644 --- a/core/modules/field/field.install +++ b/core/modules/field/field.install @@ -360,7 +360,7 @@ function field_update_8003() { $deleted_fields = $state->get('field.field.deleted') ?: array(); $deleted_instances = $state->get('field.instance.deleted') ?: array(); - $field_uuids = array(); + $field_data = array(); // Migrate field definitions. $records = db_query("SELECT * FROM {field_config}")->fetchAll(PDO::FETCH_ASSOC); @@ -421,8 +421,12 @@ function field_update_8003() { } } - // Store the UUID with the old field_id so that we can map the instances. - $field_uuids[$record['id']] = $config['uuid']; + // Store the UUID and field type, they will be used when processing + // instances. + $field_data[$record['id']] = array( + 'uuid' => $config['uuid'], + 'type' => $record['type'], + ); } // Migrate instance definitions. @@ -433,7 +437,8 @@ function field_update_8003() { $config = array( 'id' => $record['entity_type'] . '.' . $record['bundle'] . '.' . $record['field_name'], 'uuid' => $uuid->generate(), - 'field_uuid' => $field_uuids[$record['field_id']], + 'field_uuid' => $field_data[$record['field_id']]['uuid'], + 'field_type' => $field_data[$record['field_id']]['type'], 'entity_type' => $record['entity_type'], 'bundle' => $record['bundle'], 'label' => $record['data']['label'], diff --git a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php index 9db2f3d..ad3f0bd 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Core/Entity/FieldInstance.php @@ -264,6 +264,10 @@ public function __construct(array $values, $entity_type = 'field_instance') { throw new FieldException('Attempt to create an instance of an unspecified field.'); } + // Discard the 'field_type' entry that is added in config records to ease + // schema generation. See getExportProperties(). + unset($values['field_type']); + // Provide defaults. $values += array( 'label' => $values['field_name'], @@ -309,6 +313,12 @@ public function getExportProperties() { foreach ($names as $name) { $properties[$name] = $this->get($name); } + + // Adiitionally, add the field type, that is needed to be able to generate + // the field-type dependant parts of the config schema. + $field = current(field_read_fields(array('uuid' => $this->field_uuid, array('include_inactive' => TRUE, 'include_deleted' => TRUE)))); + $properties['field_type'] = $field->type; + return $properties; } diff --git a/core/modules/field/tests/modules/field_test_config/config/field.instance.test_entity.test_bundle.field_test_import.yml b/core/modules/field/tests/modules/field_test_config/config/field.instance.test_entity.test_bundle.field_test_import.yml index 3db6847..13655aa 100644 --- a/core/modules/field/tests/modules/field_test_config/config/field.instance.test_entity.test_bundle.field_test_import.yml +++ b/core/modules/field/tests/modules/field_test_config/config/field.instance.test_entity.test_bundle.field_test_import.yml @@ -18,3 +18,4 @@ widget: module: text settings: size: '60' +field_type: text diff --git a/core/modules/field/tests/modules/field_test_config/staging/field.instance.test_entity.test_bundle.field_test_import_staging.yml b/core/modules/field/tests/modules/field_test_config/staging/field.instance.test_entity.test_bundle.field_test_import_staging.yml index 5745277..2e4229d 100644 --- a/core/modules/field/tests/modules/field_test_config/staging/field.instance.test_entity.test_bundle.field_test_import_staging.yml +++ b/core/modules/field/tests/modules/field_test_config/staging/field.instance.test_entity.test_bundle.field_test_import_staging.yml @@ -18,3 +18,4 @@ widget: settings: size: '60' module: text +field_type: text diff --git a/core/modules/field_sql_storage/config/schema/field_sql_scheam.schema.yml b/core/modules/field_sql_storage/config/schema/field_sql_scheam.schema.yml new file mode 100644 index 0000000..e69a7a7 --- /dev/null +++ b/core/modules/field_sql_storage/config/schema/field_sql_scheam.schema.yml @@ -0,0 +1,7 @@ +# Schema for configuration files of the Field SQL Storage module. + +field.storage.field_sql_storage.settings: + type: sequence + label: 'Settings' + sequence: + - type: string diff --git a/core/modules/image/config/schema/image.schema.yml b/core/modules/image/config/schema/image.schema.yml index 6916f19..a8f57f7 100644 --- a/core/modules/image/config/schema/image.schema.yml +++ b/core/modules/image/config/schema/image.schema.yml @@ -1,6 +1,5 @@ -# Image module schema: image.schema.yml +# Schema for configuration files of the Image module. -# Data types for image module. image.size: type: mapping mapping: @@ -11,8 +10,6 @@ image.size: type: integer label: 'Height' -# Image styles (multiple). -# Plugin \Drupal\image\Plugin\Core\Entity\ImageStyle image.style.*: type: mapping label: 'Image style' @@ -38,8 +35,6 @@ image.style.*: type: string label: 'Default language' -# Image effects plugins: image.effect.% -# These are used in image styles. image.effect.image_crop: type: image.size label: 'Image crop' @@ -76,10 +71,69 @@ image.effect.image_scale_and_crop: type: image.size label: 'Image scale and crop' -# Schema for configuration files of image module. + image.settings: type: mapping mapping: preview_image: type: string label: 'Preview image' + +field.settings.image: + type: mapping + label: 'Image settings' + mapping: + uri_scheme: + type: string + label: 'Upload destination' + default_image: + type: string + label: 'Default image' + column_groups: + type: mapping + label: 'Column groups' + mapping: + file: + type: mapping + label: 'File settings' + mapping: + label: + type: label + label: 'Label' + columns: + type: sequence + label: 'Columns' + sequence: + - type: string + label: 'Column' + alt: + type: mapping + label: 'Alternative text' + mapping: + label: + type: label + label: 'Label' + translatable: + type: boolean + label: 'Translatable' + title: + type: mapping + label: 'Title text' + mapping: + label: + type: label + label: 'Label' + translatable: + type: boolean + label: 'Translatable' + +field.index.image: + type: mapping + label: 'Image field index settings' + mapping: + fid: + type: sequence + label: 'Fields' + sequence: + - type: string + label: 'Field' diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php index 38c57d6..0936aa5 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/FieldUpgradePathTest.php @@ -137,6 +137,7 @@ function testFieldUpgradeToConfig() { $this->assertEqual($config, array( 'id' => "node.$node_type.body", 'field_uuid' => $field_uuid, + 'field_type' => 'text_with_summary', 'entity_type' => 'node', 'bundle' => $node_type, 'label' => 'Body', diff --git a/core/modules/taxonomy/config/schema/taxonomy.schema.yml b/core/modules/taxonomy/config/schema/taxonomy.schema.yml index 48e8780..1a9754e 100644 --- a/core/modules/taxonomy/config/schema/taxonomy.schema.yml +++ b/core/modules/taxonomy/config/schema/taxonomy.schema.yml @@ -39,3 +39,21 @@ taxonomy.vocabulary.*: langcode: type: string label: 'Default language' + +field.settings.taxonomy_term_reference: + type: mapping: + label: 'Taxonomy term reference settings' + mapping: + allowed_values: + type: sequence + label: 'Allowed values' + sequence: + - type: mapping + label: 'Allowed values' + mapping: + vocabulary: + type: string + label: 'Vocabulary' + parent: + type: string + value: 'Parent' diff --git a/core/modules/text/config/schema/text.schema.yml b/core/modules/text/config/schema/text.schema.yml index 4fbe45a..450c174 100644 --- a/core/modules/text/config/schema/text.schema.yml +++ b/core/modules/text/config/schema/text.schema.yml @@ -7,3 +7,56 @@ text.settings: default_summary_length: type: integer label: 'Default summary length' + + +field.settings.text_with_summary: + type: sequence + label: 'Default' + sequence: + - type: string + +field_instance.text_textarea_with_summary.settings: + type: mapping + label: 'Text area with a summary' + mapping: + text_processing: + type: string + label: 'Text processing' + display_summary: + type: boolean + label: 'Summary input' + user_register_form: + type: boolean + label: 'Display on user registration form.' + +field_instance.text_textarea_with_summary.default: + type: sequence + label: 'Defaule value' + sequence: + - type: mapping + label: 'Default' + mapping: + summary: + type: string + label: 'Summary' + value: + type: text + label: 'Body' + format: + type: string + label: 'Text format' + +field_instance.text_textarea_with_summary.widget.settings: + type: mapping + label: 'Text area widget settings' + mapping: + rows: + type: integer + label: 'Rows' + placeholder: + type: label + label: 'Placeholder' + summary_rows: + type: integer + label: 'Summary rows' +