diff --git a/core/modules/edit/lib/Drupal/edit/Tests/EditTestBase.php b/core/modules/edit/lib/Drupal/edit/Tests/EditTestBase.php index c3a91fb..1b9ef62 100644 --- a/core/modules/edit/lib/Drupal/edit/Tests/EditTestBase.php +++ b/core/modules/edit/lib/Drupal/edit/Tests/EditTestBase.php @@ -33,7 +33,7 @@ function setUp() { $this->installSchema('field_test', 'test_entity'); // Set default storage backend. - variable_set('field_storage_default', $this->default_storage); + config('field.settings')->set('storage_default', $this->default_storage)->save(); } /** diff --git a/core/modules/field/config/field.settings.yml b/core/modules/field/config/field.settings.yml index b6172c1..1ff7290 100644 --- a/core/modules/field/config/field.settings.yml +++ b/core/modules/field/config/field.settings.yml @@ -1 +1,3 @@ purge_batch_size: 10 +storage_default: 'field_sql_storage' +language_fallback: 0 diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php index 1cf252d..93da75d 100644 --- a/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -1133,7 +1133,7 @@ function hook_field_attach_prepare_translation_alter(\Drupal\Core\Entity\EntityI function hook_field_language_alter(&$display_langcode, $context) { // Do not apply core language fallback rules if they are disabled or if Locale // is not registered as a translation handler. - if (variable_get('field_language_fallback', TRUE) && field_has_translation_handler($context['entity']->entityType())) { + if (config('field.settings')->get('language_fallback') && field_has_translation_handler($context['entity']->entityType())) { field_language_fallback($display_langcode, $context['entity'], $context['langcode']); } } diff --git a/core/modules/field/field.attach.inc b/core/modules/field/field.attach.inc index 69102f4..4da6d28 100644 --- a/core/modules/field/field.attach.inc +++ b/core/modules/field/field.attach.inc @@ -22,8 +22,9 @@ * the data in SQL differently or use a completely different storage mechanism * such as a cloud-based database. * - * Each field defines which storage backend it uses. The Drupal system variable - * 'field_storage_default' identifies the storage backend used by default. + * Each field defines which storage backend it uses. The Drupal configuration + * 'field.settings.storage_default' identifies the storage backend used by + * default. * * See @link field Field API @endlink for information about the other parts of * the Field API. diff --git a/core/modules/field/field.crud.inc b/core/modules/field/field.crud.inc index f6ee8a2..cb16cc3 100644 --- a/core/modules/field/field.crud.inc +++ b/core/modules/field/field.crud.inc @@ -43,8 +43,8 @@ * - settings: each omitted setting is given the default value defined in * hook_field_info(). * - storage: - * - type: the storage backend specified in the 'field_storage_default' - * system variable. + * - type: the storage backend specified in the + * 'field.settings.storage_default' configuration. * - settings: each omitted setting is given the default value specified in * hook_field_storage_info(). * @@ -119,7 +119,7 @@ function field_create_field($field) { // Provide default storage. $field['storage'] += array( - 'type' => variable_get('field_storage_default', 'field_sql_storage'), + 'type' => config('field.settings')->get('storage_default'), 'settings' => array(), ); // Check that the storage type is known. diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 11cd9bb..2b159a0 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -468,7 +468,7 @@ function field_entity_field_info($entity_type) { * otherwise all the fallback candidates are inspected to see if there is a * field translation available in another language. * By default this is called by field_field_language_alter(), but this - * behavior can be disabled by setting the 'field_language_fallback' + * behavior can be disabled by setting the 'field.settings.language_fallback' * variable to FALSE. * * @param $field_langcodes diff --git a/core/modules/field/field.multilingual.inc b/core/modules/field/field.multilingual.inc index a9b33ac..73f85f5 100644 --- a/core/modules/field/field.multilingual.inc +++ b/core/modules/field/field.multilingual.inc @@ -81,7 +81,7 @@ function field_language_insert() { // Because the language_count is updated only after the hook is invoked, we // check if the language_count is bigger or equal with 1 at the current time. if (variable_get('language_count', 1) >= 1) { - variable_set('field_language_fallback', TRUE); + config('field.settings')->set('language_fallback', TRUE)->save(); } } @@ -102,7 +102,7 @@ function field_language_delete() { // Because the language_count is updated after the hook is invoked, we check // if the language_count is less or equal with 2 at the current time. if (variable_get('language_count', 1) <= 2) { - variable_set('field_language_fallback', FALSE); + config('field.settings')->set('language_fallback', FALSE)->save(); } } @@ -336,7 +336,7 @@ function field_language(EntityInterface $entity, $field_name = NULL, $langcode = ); // Do not apply core language fallback rules if they are disabled or if // the entity does not have a translation handler registered. - if (variable_get('field_language_fallback', FALSE) && field_has_translation_handler($entity_type)) { + if (config('field.settings')->get('language_fallback') && field_has_translation_handler($entity_type)) { field_language_fallback($display_langcode, $context['entity'], $context['langcode']); } drupal_alter('field_language', $display_langcode, $context); diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php index 976aa05..1bcddb1 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php +++ b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php @@ -195,7 +195,7 @@ public function query($use_groupby = FALSE) { $this->view->display_handler->options['field_langcode']); $placeholder = $this->placeholder(); $langcode_fallback_candidates = array($langcode); - if (variable_get('locale_field_language_fallback', TRUE)) { + if (config('field.settings')->get('language_fallback')) { require_once DRUPAL_ROOT . '/includes/language.inc'; $langcode_fallback_candidates = array_merge($langcode_fallback_candidates, language_fallback_get_candidates()); } diff --git a/core/modules/field/lib/Drupal/field/Tests/CrudTest.php b/core/modules/field/lib/Drupal/field/Tests/CrudTest.php index f7c3a9c..69d3cb3 100644 --- a/core/modules/field/lib/Drupal/field/Tests/CrudTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/CrudTest.php @@ -62,7 +62,7 @@ function testCreateField() { $this->assertIdentical($record['data']['settings'], $field_type['settings'], 'Default field settings have been written.'); // Ensure that default storage was set. - $this->assertEqual($record['storage_type'], variable_get('field_storage_default'), 'The field type is properly saved.'); + $this->assertEqual($record['storage_type'], config('field.settings')->get('storage_default'), 'The field type is properly saved.'); // Guarantee that the name is unique. try { diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldTestBase.php b/core/modules/field/lib/Drupal/field/Tests/FieldTestBase.php index a34586e..ee10301 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldTestBase.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldTestBase.php @@ -23,7 +23,7 @@ function setUp() { parent::setUp(); // Set default storage backend. - variable_set('field_storage_default', $this->default_storage); + config('field.settings')->set('storage_default', $this->default_storage)->save(); } /** diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php b/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php index 94b068d..de3c3d6 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldUnitTestBase.php @@ -41,7 +41,7 @@ function setUp() { $this->installSchema('field_test', array('test_entity', 'test_entity_revision', 'test_entity_bundle')); // Set default storage backend. - variable_set('field_storage_default', $this->default_storage); + config('field.setttings')->set('storage_default', $this->default_storage)->save(); } /**