diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php index ca775e9..c6bd4bc 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php @@ -47,7 +47,7 @@ function setUp() { ), ), ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $this->instance = array( 'field_name' => 'taxonomy_' . $this->vocabulary->id(), @@ -57,7 +57,7 @@ function setUp() { 'type' => 'options_select', ), ); - field_create_instance($this->instance); + entity_create('field_instance', $this->instance)->save(); entity_get_display('node', 'article', 'default') ->setComponent('taxonomy_' . $this->vocabulary->id(), array( 'type' => 'taxonomy_term_reference_link', diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php index abb5893..3357841 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php @@ -55,7 +55,7 @@ public function setUp() { ), ), ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $instance = array( 'entity_type' => 'entity_test', 'field_name' => 'field_test_taxonomy', @@ -64,7 +64,7 @@ public function setUp() { 'type' => 'options_select', ), ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); $this->term = entity_create('taxonomy_term', array( 'name' => $this->randomName(), 'vid' => $vocabulary->id(), diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php index 4f71f53..3c75edc 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php @@ -58,7 +58,7 @@ function setUp() { ), ) ); - field_create_field($this->field); + entity_create('field_entity', $this->field)->save(); $this->instance = array( 'field_name' => $this->field_name, 'entity_type' => 'test_entity', @@ -67,7 +67,7 @@ function setUp() { 'type' => 'options_select', ), ); - field_create_instance($this->instance); + entity_create('field_instance', $this->instance)->save(); entity_get_display('test_entity', 'test_bundle', 'full') ->setComponent($this->field_name, array( 'type' => 'taxonomy_term_reference_link', diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php index 363d326..da625b0 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php @@ -41,7 +41,7 @@ function setUp() { // Setup a field and instance. $this->field_name = drupal_strtolower($this->randomName()); - $this->field = array( + $this->field = entity_create('field_entity', array( 'field_name' => $this->field_name, 'type' => 'taxonomy_term_reference', 'settings' => array( @@ -52,8 +52,8 @@ function setUp() { ), ), ) - ); - field_create_field($this->field); + )); + $this->field->save(); $this->instance = array( 'field_name' => $this->field_name, 'entity_type' => 'test_entity', @@ -62,7 +62,7 @@ function setUp() { 'type' => 'options_select', ), ); - field_create_instance($this->instance); + entity_create('field_instance', $this->instance)->save(); entity_get_display('test_entity', 'test_bundle', 'full') ->setComponent($this->field_name, array( 'type' => 'taxonomy_term_reference_link', @@ -155,7 +155,7 @@ function testTaxonomyTermFieldChangeMachineName() { 'parent' => '0', ), ); - field_update_field($this->field); + $this->field->save(); // Change the machine name. $new_name = drupal_strtolower($this->randomName()); $this->vocabulary->vid = $new_name; diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php index 237f4b4..82ce984 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php @@ -44,7 +44,7 @@ function setUp() { ), ), ); - field_create_field($this->field_1); + entity_create('field_entity', $this->field_1)->save(); $this->instance_1 = array( 'field_name' => $this->field_name_1, 'bundle' => 'article', @@ -53,7 +53,7 @@ function setUp() { 'type' => 'options_select', ), ); - field_create_instance($this->instance_1); + entity_create('field_instance', $this->instance_1)->save(); entity_get_display('node', 'article', 'default') ->setComponent($this->field_name_1, array( 'type' => 'taxonomy_term_reference_link', @@ -74,7 +74,7 @@ function setUp() { ), ), ); - field_create_field($this->field_2); + entity_create('field_entity', $this->field_2)->save(); $this->instance_2 = array( 'field_name' => $this->field_name_2, 'bundle' => 'article', @@ -83,7 +83,7 @@ function setUp() { 'type' => 'options_select', ), ); - field_create_instance($this->instance_2); + entity_create('field_instance', $this->instance_2)->save(); entity_get_display('node', 'article', 'default') ->setComponent($this->field_name_2, array( 'type' => 'taxonomy_term_reference_link', diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php index 705ff60..51090ee 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php @@ -39,17 +39,17 @@ function setUp() { ), ), ); - field_create_field($field); + entity_create('field_entity', $field)->save(); - $this->instance = array( + $this->instance = entity_create('field_instance', array( 'field_name' => 'taxonomy_' . $this->vocabulary->id(), 'bundle' => 'article', 'entity_type' => 'node', 'widget' => array( 'type' => 'options_select', ), - ); - field_create_instance($this->instance); + )); + $this->instance->save(); entity_get_display('node', 'article', 'default') ->setComponent($this->instance['field_name'], array( 'type' => 'taxonomy_term_reference_link', @@ -148,7 +148,7 @@ function testNodeTermCreationAndDeletion() { 'placeholder' => 'Start typing here.', ), ); - field_update_instance($instance); + $instance->save(); $terms = array( 'term1' => $this->randomName(), 'term2' => $this->randomName(), @@ -507,7 +507,7 @@ function testReSavingTags() { // Enable tags in the vocabulary. $instance = $this->instance; $instance['widget'] = array('type' => 'taxonomy_autocomplete'); - field_update_instance($instance); + $instance->save(); // Create a term and a node using it. $term = $this->createTerm($this->vocabulary); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php index 0a45dd2..a984871 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php @@ -40,7 +40,7 @@ function setUp() { ), ), ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $this->instance = array( 'field_name' => 'taxonomy_' . $this->vocabulary->id(), @@ -50,7 +50,7 @@ function setUp() { 'type' => 'options_select', ), ); - field_create_instance($this->instance); + entity_create('field_instance', $this->instance)->save(); entity_get_display('node', 'article', 'default') ->setComponent('taxonomy_' . $this->vocabulary->id(), array( 'type' => 'taxonomy_term_reference_link', diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php index 6de1b17..2839dfc 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php @@ -94,7 +94,7 @@ protected function mockStandardInstall() { ), ), ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $instance = array( 'field_name' => 'field_' . $this->vocabulary->id(), 'entity_type' => 'node', @@ -105,7 +105,7 @@ protected function mockStandardInstall() { 'weight' => -4, ), ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); entity_get_display('node', 'article', 'default') ->setComponent($instance['field_name'], array( diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php index e427b4e..ddbfd40 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php @@ -145,13 +145,13 @@ function testTaxonomyVocabularyChangeMachineName() { 'field_name' => 'field_test', 'type' => 'test_field', ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $instance = array( 'field_name' => 'field_test', 'entity_type' => 'taxonomy_term', 'bundle' => $this->vocabulary->id(), ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); // Change the machine name. $old_name = $this->vocabulary->id(); @@ -176,14 +176,14 @@ function testUninstallReinstall() { // removed when the module is uninstalled. $this->field_name = drupal_strtolower($this->randomName() . '_field_name'); $this->field_definition = array('field_name' => $this->field_name, 'type' => 'text', 'cardinality' => 4); - field_create_field($this->field_definition); + entity_create('field_entity', $this->field_definition)->save(); $this->instance_definition = array( 'field_name' => $this->field_name, 'entity_type' => 'taxonomy_term', 'bundle' => $this->vocabulary->id(), 'label' => $this->randomName() . '_label', ); - field_create_instance($this->instance_definition); + entity_create('field_instance', $this->instance_definition)->save(); module_disable(array('taxonomy')); require_once DRUPAL_ROOT . '/core/includes/install.inc'; @@ -196,7 +196,7 @@ function testUninstallReinstall() { // an instance of this field on the same bundle name should be successful. $this->vocabulary->enforceIsNew(); taxonomy_vocabulary_save($this->vocabulary); - field_create_field($this->field_definition); - field_create_instance($this->instance_definition); + entity_create('field_entity', $this->field_definition)->save(); + entity_create('field_instance', $this->instance_definition)->save(); } } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php index dcda5e8..80401e1 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyStorageController.php @@ -36,7 +36,7 @@ protected function postSave(EntityInterface $entity, $update) { } } if ($update_field) { - field_update_field($field); + $field->save(); } } } @@ -82,11 +82,11 @@ protected function postDelete($entities) { } if ($modified_field) { if (empty($taxonomy_field['settings']['allowed_values'])) { - field_delete_field($field_name); + $taxonomy_field->delete(); } else { // Update the field definition with the new allowed values. - field_update_field($taxonomy_field); + $taxonomy_field->save(); } } } diff --git a/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php b/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php index 1bec98f..d3610e3 100644 --- a/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php +++ b/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php @@ -57,7 +57,7 @@ function testTelephoneField() { 'field_name' => 'field_telephone', 'type' => 'telephone', ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $instance = array( 'field_name' => 'field_telephone', @@ -71,7 +71,7 @@ function testTelephoneField() { ), ), ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); entity_get_display('node', 'article', 'default') ->setComponent('field_telephone', array( diff --git a/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneItemTest.php b/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneItemTest.php index 35012b3..47fa600 100644 --- a/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneItemTest.php +++ b/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneItemTest.php @@ -39,7 +39,7 @@ public function setUp() { 'field_name' => 'field_test', 'type' => 'telephone', ); - field_create_field($this->field); + entity_create('field_entity', $this->field)->save(); $this->instance = array( 'entity_type' => 'entity_test', 'field_name' => 'field_test', @@ -48,7 +48,7 @@ public function setUp() { 'type' => 'telephone_default', ), ); - field_create_instance($this->instance); + entity_create('field_instance', $this->instance)->save(); } /** diff --git a/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php b/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php index 7126384..1e8711a 100644 --- a/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php +++ b/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php @@ -67,14 +67,14 @@ function setUp() { $this->formatter_type = 'text_plain'; $this->formatter_settings = array(); - $this->field = array( + $this->field = entity_create('field_entity', array( 'field_name' => $this->field_name, 'type' => $this->field_type, 'settings' => $this->field_settings, - ); - $this->field = field_create_field($this->field); + )); + $this->field->save(); - $this->instance = array( + $this->instance = entity_create('field_instance', array( 'entity_type' => $this->entity_type, 'bundle' => $this->bundle, 'field_name' => $this->field_name, @@ -84,8 +84,8 @@ function setUp() { 'type' => $this->widget_type, 'settings' => $this->widget_settings, ), - ); - $this->instance = field_create_instance($this->instance); + )); + $this->instance->save(); $this->view_mode = 'default'; $this->display = entity_get_display($this->entity_type, $this->bundle, $this->view_mode) diff --git a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php index f8c585b..17487a0 100644 --- a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php +++ b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php @@ -57,7 +57,7 @@ function testTextFieldValidation() { 'max_length' => $max_length, ) ); - field_create_field($this->field); + entity_create('field_entity', $this->field)->save(); $this->instance = array( 'field_name' => $this->field['field_name'], 'entity_type' => 'test_entity', @@ -66,7 +66,7 @@ function testTextFieldValidation() { 'type' => 'text_textfield', ), ); - field_create_instance($this->instance); + entity_create('field_instance', $this->instance)->save(); entity_get_display('test_entity', 'test_bundle', 'default') ->setComponent($this->field['field_name']) ->save(); @@ -102,7 +102,7 @@ function _testTextfieldWidgets($field_type, $widget_type) { $entity_type = 'test_entity'; $this->field_name = drupal_strtolower($this->randomName()); $this->field = array('field_name' => $this->field_name, 'type' => $field_type); - field_create_field($this->field); + entity_create('field_entity', $this->field)->save(); $this->instance = array( 'field_name' => $this->field_name, 'entity_type' => 'test_entity', @@ -118,7 +118,7 @@ function _testTextfieldWidgets($field_type, $widget_type) { ), ), ); - field_create_instance($this->instance); + entity_create('field_instance', $this->instance)->save(); entity_get_display('test_entity', 'test_bundle', 'full') ->setComponent($this->field_name) ->save(); @@ -165,7 +165,7 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) { $entity_type = 'test_entity'; $this->field_name = drupal_strtolower($this->randomName()); $this->field = array('field_name' => $this->field_name, 'type' => $field_type); - field_create_field($this->field); + entity_create('field_entity', $this->field)->save(); $this->instance = array( 'field_name' => $this->field_name, 'entity_type' => 'test_entity', @@ -178,7 +178,7 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) { 'type' => $widget_type, ), ); - field_create_instance($this->instance); + entity_create('field_instance', $this->instance)->save(); entity_get_display('test_entity', 'test_bundle', 'full') ->setComponent($this->field_name) ->save(); diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncImageTest.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncImageTest.php index 61f93cf..ecdac68 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncImageTest.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationSyncImageTest.php @@ -62,7 +62,7 @@ protected function setupTestFields() { 'cardinality' => $this->cardinality, 'translatable' => TRUE, ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $instance = array( 'entity_type' => $this->entityType, @@ -81,7 +81,7 @@ protected function setupTestFields() { ), ), ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); } /** diff --git a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationTestBase.php b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationTestBase.php index 13e1f59..06a0994 100644 --- a/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationTestBase.php +++ b/core/modules/translation_entity/lib/Drupal/translation_entity/Tests/EntityTranslationTestBase.php @@ -163,7 +163,7 @@ protected function setupTestFields() { 'cardinality' => 1, 'translatable' => TRUE, ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $instance = array( 'entity_type' => $this->entityType, @@ -175,7 +175,7 @@ protected function setupTestFields() { 'weight' => 0, ), ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); } /** diff --git a/core/modules/translation_entity/translation_entity.admin.inc b/core/modules/translation_entity/translation_entity.admin.inc index 7aa91bf..b7a104f 100644 --- a/core/modules/translation_entity/translation_entity.admin.inc +++ b/core/modules/translation_entity/translation_entity.admin.inc @@ -439,7 +439,7 @@ function translation_entity_translatable_switch($translatable, $field_name) { $field = field_info_field($field_name); if ($field['translatable'] !== $translatable) { $field['translatable'] = $translatable; - field_update_field($field); + $field->save(); } } diff --git a/core/modules/translation_entity/translation_entity.module b/core/modules/translation_entity/translation_entity.module index e4dca3e..e0c8b81 100644 --- a/core/modules/translation_entity/translation_entity.module +++ b/core/modules/translation_entity/translation_entity.module @@ -1025,7 +1025,7 @@ function translation_entity_save_settings($settings) { else { unset($instance['settings']['translation_sync']); } - field_update_instance($instance); + entity_create('field_instance', $instance)->save(); } } }