diff --git a/core/lib/Drupal/Core/Field/BaseFieldDefinition.php b/core/lib/Drupal/Core/Field/BaseFieldDefinition.php index be65768..4a67e45 100644 --- a/core/lib/Drupal/Core/Field/BaseFieldDefinition.php +++ b/core/lib/Drupal/Core/Field/BaseFieldDefinition.php @@ -62,7 +62,7 @@ public static function create($type) { // settings for the field type. // @todo Cleanup in https://drupal.org/node/2116341. $field_type_manager = \Drupal::service('plugin.manager.field.field_type'); - $default_settings = $field_type_manager->getDefaultSettings($type) + $field_type_manager->getDefaultFieldSettings($type); + $default_settings = $field_type_manager->getDefaultStorageSettings($type) + $field_type_manager->getDefaultFieldSettings($type); $field_definition->itemDefinition->setSettings($default_settings); return $field_definition; } diff --git a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php index a145960..b3e9473 100644 --- a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php +++ b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php @@ -53,7 +53,7 @@ public function getDefaultStorageSettings($type) { $plugin_definition = $this->getDefinition($type, FALSE); if (!empty($plugin_definition['class'])) { $plugin_class = DefaultFactory::getPluginClass($type, $plugin_definition); - return $plugin_class::defaultSettings(); + return $plugin_class::defaultStorageSettings(); } return array(); } diff --git a/core/modules/field/src/Entity/FieldStorageConfig.php b/core/modules/field/src/Entity/FieldStorageConfig.php index 55be5f3..4018f1a 100644 --- a/core/modules/field/src/Entity/FieldStorageConfig.php +++ b/core/modules/field/src/Entity/FieldStorageConfig.php @@ -288,7 +288,7 @@ protected function preSaveNew(EntityStorageInterface $storage) { // Make sure all settings are present, so that a complete field // definition is passed to the various hooks and written to config. - $this->settings += $field_type_manager->getDefaultSettings($this->type); + $this->settings += $field_type_manager->getDefaultStorageSettings($this->type); // Notify the entity storage. $entity_manager->getStorage($this->entity_type)->onFieldStorageDefinitionCreate($this); @@ -328,7 +328,7 @@ protected function preSaveUpdated(EntityStorageInterface $storage) { // Make sure all settings are present, so that a complete field // definition is passed to the various hooks and written to config. - $this->settings += $field_type_manager->getDefaultSettings($this->type); + $this->settings += $field_type_manager->getDefaultStorageSettings($this->type); // See if any module forbids the update by throwing an exception. This // invokes hook_field_storage_config_update_forbid(). @@ -503,7 +503,7 @@ public function getSettings() { // within $this. $field_type_manager = \Drupal::service('plugin.manager.field.field_type'); - $settings = $field_type_manager->getDefaultSettings($this->type); + $settings = $field_type_manager->getDefaultStorageSettings($this->type); return $this->settings + $settings; } diff --git a/core/modules/field/src/FieldStorageConfigStorage.php b/core/modules/field/src/FieldStorageConfigStorage.php index 38b2865..6353731 100644 --- a/core/modules/field/src/FieldStorageConfigStorage.php +++ b/core/modules/field/src/FieldStorageConfigStorage.php @@ -171,7 +171,7 @@ public function loadByProperties(array $conditions = array()) { protected function mapFromStorageRecords(array $records) { foreach ($records as &$record) { $class = $this->fieldTypeManager->getPluginClass($record['type']); - $record['settings'] = $class::settingsFromConfigData($record['settings']); + $record['settings'] = $class::storageSettingsFromConfigData($record['settings']); } return parent::mapFromStorageRecords($records); } @@ -182,7 +182,7 @@ protected function mapFromStorageRecords(array $records) { protected function mapToStorageRecord(EntityInterface $entity) { $record = parent::mapToStorageRecord($entity); $class = $this->fieldTypeManager->getPluginClass($record['type']); - $record['settings'] = $class::settingsToConfigData($record['settings']); + $record['settings'] = $class::storageSettingsToConfigData($record['settings']); return $record; } diff --git a/core/modules/field/src/Tests/CrudTest.php b/core/modules/field/src/Tests/CrudTest.php index 34061f8..770155a 100644 --- a/core/modules/field/src/Tests/CrudTest.php +++ b/core/modules/field/src/Tests/CrudTest.php @@ -63,7 +63,7 @@ function testCreate() { // Ensure that default settings are present. $field_type_manager = \Drupal::service('plugin.manager.field.field_type'); - $this->assertEqual($field_storage_config['settings'], $field_type_manager->getDefaultSettings($field_storage_definition['type']), 'Default field settings have been written.'); + $this->assertEqual($field_storage_config['settings'], $field_type_manager->getDefaultStorageSettings($field_storage_definition['type']), 'Default storage settings have been written.'); // Guarantee that the name is unique. try { diff --git a/core/modules/field/src/Tests/FieldTypePluginManagerTest.php b/core/modules/field/src/Tests/FieldTypePluginManagerTest.php index 14a9d61..ea12c40 100644 --- a/core/modules/field/src/Tests/FieldTypePluginManagerTest.php +++ b/core/modules/field/src/Tests/FieldTypePluginManagerTest.php @@ -21,7 +21,7 @@ function testDefaultSettings() { $field_type_manager = \Drupal::service('plugin.manager.field.field_type'); foreach (array('test_field', 'shape', 'hidden_test_field') as $type) { $definition = $field_type_manager->getDefinition($type); - $this->assertIdentical($field_type_manager->getDefaultSettings($type), $definition['class']::defaultSettings(), format_string("%type storage settings were returned", array('%type' => $type))); + $this->assertIdentical($field_type_manager->getDefaultStorageSettings($type), $definition['class']::defaultStorageSettings(), format_string("%type storage settings were returned", array('%type' => $type))); $this->assertIdentical($field_type_manager->getDefaultFieldSettings($type), $definition['class']::defaultFieldSettings(), format_string(" %type field settings were returned", array('%type' => $type))); } } diff --git a/core/modules/image/image.module b/core/modules/image/image.module index 4003c04..42639e5 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -350,7 +350,7 @@ function image_entity_presave(EntityInterface $entity) { } elseif ($entity_type_id == 'field_storage_config') { $field_storage = $entity; - $default_settings = \Drupal::service('plugin.manager.field.field_type')->getDefaultSettings('image'); + $default_settings = \Drupal::service('plugin.manager.field.field_type')->getDefaultStorageSettings('image'); } // Exit, if not saving an image field or image field instance entity. if (!$field_storage || $field_storage->type != 'image') {