only in patch2: unchanged: --- 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'], only in patch2: unchanged: --- 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; } only in patch2: unchanged: --- 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 only in patch2: unchanged: --- 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 only in patch2: unchanged: --- 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',