diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php index 118e813..ec13a42 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/RssTest.php @@ -36,7 +36,7 @@ function setUp() { $this->drupalLogin($this->admin_user); $this->vocabulary = $this->createVocabulary(); - $field = array( + entity_create('field_entity', array( 'field_name' => 'taxonomy_' . $this->vocabulary->id(), 'type' => 'taxonomy_term_reference', 'cardinality' => FIELD_CARDINALITY_UNLIMITED, @@ -48,15 +48,12 @@ function setUp() { ), ), ), - ); - field_create_field($field); - - $this->instance = array( + ))->save(); + entity_create('field_instance', array( 'field_name' => 'taxonomy_' . $this->vocabulary->id(), 'bundle' => 'article', 'entity_type' => 'node', - ); - field_create_instance($this->instance); + ))->save(); entity_get_form_display('node', 'article', 'default') ->setComponent($field['field_name'], array( 'type' => 'options_select', diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php index a8aefcb..fa39d83 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TaxonomyTermReferenceItemTest.php @@ -43,7 +43,8 @@ public function setUp() { 'langcode' => Language::LANGCODE_NOT_SPECIFIED, )); $vocabulary->save(); - $field = array( + + entity_create('field_entity', array( 'field_name' => 'field_test_taxonomy', 'type' => 'taxonomy_term_reference', 'cardinality' => FIELD_CARDINALITY_UNLIMITED, @@ -55,14 +56,12 @@ public function setUp() { ), ), ), - ); - field_create_field($field); - $instance = array( + ))->save(); + entity_create('field_instance', array( 'entity_type' => 'entity_test', 'field_name' => 'field_test_taxonomy', 'bundle' => 'entity_test', - ); - field_create_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 8284e39..0b9ec69 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldMultipleVocabularyTest.php @@ -43,7 +43,7 @@ function setUp() { // Set up a field and instance. $this->field_name = drupal_strtolower($this->randomName()); - $this->field = array( + entity_create('field_entity', array( 'field_name' => $this->field_name, 'type' => 'taxonomy_term_reference', 'cardinality' => FIELD_CARDINALITY_UNLIMITED, @@ -59,14 +59,12 @@ function setUp() { ), ), ) - ); - field_create_field($this->field); - $this->instance = array( + ))->save(); + entity_create('field_instance',array( 'field_name' => $this->field_name, 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', - ); - field_create_instance($this->instance); + ))->save(); entity_get_form_display('test_entity', 'test_bundle', 'default') ->setComponent($this->field_name, array( 'type' => 'options_select', diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php index 541d7be..943e515 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermFieldTest.php @@ -42,7 +42,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( @@ -53,14 +53,12 @@ function setUp() { ), ), ) - ); - field_create_field($this->field); - $this->instance = array( + ))->save(); + entity_create('field_instance', array( 'field_name' => $this->field_name, 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', - ); - field_create_instance($this->instance); + ))->save(); entity_get_form_display('test_entity', 'test_bundle', 'default') ->setComponent($this->field_name, array( 'type' => 'options_select', @@ -144,7 +142,7 @@ function testTaxonomyTermFieldWidgets() { function testTaxonomyTermFieldChangeMachineName() { // Add several entries in the 'allowed_values' setting, to make sure that // they all get updated. - $this->field['settings']['allowed_values'] = array( + $this->field->settings['allowed_values'] = array( array( 'vocabulary' => $this->vocabulary->id(), 'parent' => '0', @@ -158,7 +156,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 d6280c8..937511f 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php @@ -33,7 +33,7 @@ function setUp() { $this->vocabulary = $this->createVocabulary(); $this->field_name_1 = drupal_strtolower($this->randomName()); - $this->field_1 = array( + entity_create('field_entity', array( 'field_name' => $this->field_name_1, 'type' => 'taxonomy_term_reference', 'cardinality' => FIELD_CARDINALITY_UNLIMITED, @@ -45,14 +45,12 @@ function setUp() { ), ), ), - ); - field_create_field($this->field_1); - $this->instance_1 = array( + ))->save(); + entity_create('field_instance', array( 'field_name' => $this->field_name_1, 'bundle' => 'article', 'entity_type' => 'node', - ); - field_create_instance($this->instance_1); + ))->save(); entity_get_form_display('node', 'article', 'default') ->setComponent($this->field_name_1, array( 'type' => 'options_select', @@ -65,7 +63,7 @@ function setUp() { ->save(); $this->field_name_2 = drupal_strtolower($this->randomName()); - $this->field_2 = array( + entity_create('field_entity', array( 'field_name' => $this->field_name_2, 'type' => 'taxonomy_term_reference', 'cardinality' => FIELD_CARDINALITY_UNLIMITED, @@ -77,14 +75,12 @@ function setUp() { ), ), ), - ); - field_create_field($this->field_2); - $this->instance_2 = array( + ))->save(); + entity_create('field_instance', array( 'field_name' => $this->field_name_2, 'bundle' => 'article', 'entity_type' => 'node', - ); - field_create_instance($this->instance_2); + ))->save(); entity_get_form_display('node', 'article', 'default') ->setComponent($this->field_name_2, array( 'type' => 'options_select', diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php index 2a0907d..caf5397 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php @@ -41,14 +41,14 @@ 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', - ); - field_create_instance($this->instance); + )); + $this->instance->save(); entity_get_form_display('node', 'article', 'default') ->setComponent('taxonomy_' . $this->vocabulary->id(), array( 'type' => 'options_select', diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php index 9bd8b2f..eec5921 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TokenReplaceTest.php @@ -28,9 +28,9 @@ function setUp() { $this->drupalLogin($this->admin_user); $this->vocabulary = $this->createVocabulary(); $this->langcode = Language::LANGCODE_NOT_SPECIFIED; - - $field = array( - 'field_name' => 'taxonomy_' . $this->vocabulary->id(), + $this->field_name = 'taxonomy_' . $this->vocabulary->id(); + entity_create('field_entity', array( + 'field_name' => $this->field_name, 'type' => 'taxonomy_term_reference', 'cardinality' => FIELD_CARDINALITY_UNLIMITED, 'settings' => array( @@ -41,22 +41,20 @@ function setUp() { ), ), ), - ); - field_create_field($field); + ))->save(); - $this->instance = array( - 'field_name' => 'taxonomy_' . $this->vocabulary->id(), + entity_create('field_instance', array( + 'field_name' => $this->field_name, 'bundle' => 'article', 'entity_type' => 'node', - ); - field_create_instance($this->instance); + ))->save(); entity_get_form_display('node', 'article', 'default') - ->setComponent('taxonomy_' . $this->vocabulary->id(), array( + ->setComponent($this->field_name, array( 'type' => 'options_select', )) ->save(); entity_get_display('node', 'article', 'default') - ->setComponent('taxonomy_' . $this->vocabulary->id(), array( + ->setComponent($this->field_name, array( 'type' => 'taxonomy_term_reference_link', )) ->save(); @@ -82,7 +80,7 @@ function testTaxonomyTokenReplacement() { // Create node with term2. $edit = array(); $node = $this->drupalCreateNode(array('type' => 'article')); - $edit[$this->instance['field_name'] . '[' . $this->langcode . '][]'] = $term2->id(); + $edit[$this->field_name . '[' . $this->langcode . '][]'] = $term2->id(); $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); // Generate and test sanitized tokens for term1. 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 74c546b..362c717 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/Views/TaxonomyTestBase.php @@ -81,8 +81,9 @@ protected function mockStandardInstall() { 'vid' => 'views_testing_tags', )); $this->vocabulary->save(); - $field = array( - 'field_name' => 'field_' . $this->vocabulary->id(), + $this->field_name = 'field_' . $this->vocabulary->id(); + entity_create('field_entity', array( + 'field_name' => $this->field_name, 'type' => 'taxonomy_term_reference', // Set cardinality to unlimited for tagging. 'cardinality' => FIELD_CARDINALITY_UNLIMITED, @@ -94,31 +95,29 @@ protected function mockStandardInstall() { ), ), ), - ); - field_create_field($field); - $instance = array( - 'field_name' => 'field_' . $this->vocabulary->id(), + ))->save(); + $instance = entity_create('field_instance', array( + 'field_name' => $this->field_name, 'entity_type' => 'node', 'label' => 'Tags', 'bundle' => 'article', - ); - field_create_instance($instance); + ))->save(); entity_get_form_display('node', 'article', 'default') - ->setComponent($instance['field_name'], array( + ->setComponent($this->field_name, array( 'type' => 'taxonomy_autocomplete', 'weight' => -4, )) ->save(); entity_get_display('node', 'article', 'default') - ->setComponent($instance['field_name'], array( + ->setComponent($this->field_name], array( 'type' => 'taxonomy_term_reference_link', 'weight' => 10, )) ->save(); entity_get_display('node', 'article', 'teaser') - ->setComponent($instance['field_name'], array( + ->setComponent($this->field_name, array( 'type' => 'taxonomy_term_reference_link', 'weight' => 10, )) diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php index 909cbcb..fca741c 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php @@ -154,17 +154,15 @@ function testTaxonomyVocabularyLoadMultiple() { */ function testTaxonomyVocabularyChangeMachineName() { // Add a field instance to the vocabulary. - $field = array( + entity_create('field_entity', array( 'field_name' => 'field_test', 'type' => 'test_field', - ); - field_create_field($field); - $instance = array( + ))->save(); + entity_create('field_instance', array( 'field_name' => 'field_test', 'entity_type' => 'taxonomy_term', 'bundle' => $this->vocabulary->id(), - ); - field_create_instance($instance); + ))->save(); // Change the machine name. $old_name = $this->vocabulary->id(); @@ -188,15 +186,17 @@ function testUninstallReinstall() { // Fields and field instances attached to taxonomy term bundles should be // 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); - $this->instance_definition = array( + entity_create('field_entity', array( + 'field_name' => $this->field_name, + 'type' => 'text', + 'cardinality' => 4 + ))->save(); + entity_create('field_instance', array( 'field_name' => $this->field_name, 'entity_type' => 'taxonomy_term', 'bundle' => $this->vocabulary->id(), 'label' => $this->randomName() . '_label', - ); - field_create_instance($this->instance_definition); + ))->save(); module_disable(array('taxonomy')); require_once DRUPAL_ROOT . '/core/includes/install.inc'; @@ -209,7 +209,7 @@ function testUninstallReinstall() { // an instance of this field on the same bundle name should be successful. $this->vocabulary->enforceIsNew(); $this->vocabulary->save(); - 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 c0e377b..d3d778b 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 0d5aa47..6158f07 100644 --- a/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php +++ b/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneFieldTest.php @@ -53,19 +53,16 @@ function setUp() { function testTelephoneField() { // Add the telepone field to the article content type. - $field = array( + entity_create('field_entity', array( 'field_name' => 'field_telephone', 'type' => 'telephone', - ); - field_create_field($field); - - $instance = array( + ))->save(); + entity_create('field_instance', array( 'field_name' => 'field_telephone', 'label' => 'Telephone Number', 'entity_type' => 'node', 'bundle' => 'article', - ); - field_create_instance($instance); + ))->save(); entity_get_form_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 d809161..bd3633b 100644 --- a/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneItemTest.php +++ b/core/modules/telephone/lib/Drupal/telephone/Tests/TelephoneItemTest.php @@ -35,17 +35,15 @@ public function setUp() { parent::setUp(); // Create a telephone field and instance for validation. - $this->field = array( + entity_create('field_entity', array( 'field_name' => 'field_test', 'type' => 'telephone', - ); - field_create_field($this->field); - $this->instance = array( + ))->save(); + entity_create('field_instance', array( 'entity_type' => 'entity_test', 'field_name' => 'field_test', 'bundle' => 'entity_test', - ); - field_create_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 dbc8524..db1c9d2 100644 --- a/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php +++ b/core/modules/text/lib/Drupal/text/Tests/Formatter/TextPlainUnitTest.php @@ -66,21 +66,21 @@ 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, 'label' => $this->randomName(), 'settings' => $this->instance_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 118d98f..0979fe0 100644 --- a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php +++ b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php @@ -51,20 +51,18 @@ function setUp() { function testTextFieldValidation() { // Create a field with settings to validate. $max_length = 3; - $this->field = array( + entity_create('field_entity', array( 'field_name' => drupal_strtolower($this->randomName()), 'type' => 'text', 'settings' => array( 'max_length' => $max_length, ) - ); - field_create_field($this->field); - $this->instance = array( - 'field_name' => $this->field['field_name'], + ))->save(); + entity_create('field_instance', instance = array( + 'field_name' => $this->field->id(), 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', - ); - field_create_instance($this->instance); + ))->save(); // Test valid and invalid values with field_attach_validate(). $entity = field_test_create_entity(); @@ -96,9 +94,11 @@ function _testTextfieldWidgets($field_type, $widget_type) { // Setup a field and instance $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); - $this->instance = array( + entity_create('field_entity', array( + 'field_name' => $this->field_name, + 'type' => $field_type + ))->save(); + entity_create('field_instance', array( 'field_name' => $this->field_name, 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', @@ -106,8 +106,7 @@ function _testTextfieldWidgets($field_type, $widget_type) { 'settings' => array( 'text_processing' => TRUE, ), - ); - field_create_instance($this->instance); + ))->save(); entity_get_form_display('test_entity', 'test_bundle', 'default') ->setComponent($this->field_name, array( 'type' => $widget_type, @@ -161,9 +160,11 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) { // Setup a field and instance $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); - $this->instance = array( + entity_create('field_entity', array( + 'field_name' => $this->field_name, + 'type' => $field_type + ))->save(); + entity_create('field_instance', array( 'field_name' => $this->field_name, 'entity_type' => 'test_entity', 'bundle' => 'test_bundle', @@ -171,8 +172,7 @@ function _testTextfieldWidgetsFormatted($field_type, $widget_type) { 'settings' => array( 'text_processing' => TRUE, ), - ); - field_create_instance($this->instance); + ))->save(); entity_get_form_display('test_entity', 'test_bundle', 'default') ->setComponent($this->field_name, array( 'type' => $widget_type, 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 aa9c626..2bedb35 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 @@ -56,15 +56,14 @@ protected function setupTestFields() { $this->fieldName = 'field_test_et_ui_image'; $this->cardinality = 3; - $field = array( + entity_create('field_entity', array( 'field_name' => $this->fieldName, 'type' => 'image', 'cardinality' => $this->cardinality, 'translatable' => TRUE, - ); - field_create_field($field); + ))->save(); - $instance = array( + entity_create('field_instance', array( 'entity_type' => $this->entityType, 'field_name' => $this->fieldName, 'bundle' => $this->entityType, @@ -76,8 +75,7 @@ protected function setupTestFields() { 'title' => 'title', ), ), - ); - field_create_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 31592c7..4ceb6c4 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 @@ -161,21 +161,18 @@ protected function enableTranslation() { protected function setupTestFields() { $this->fieldName = 'field_test_et_ui_test'; - $field = array( + entity_create('field_entity', array( 'field_name' => $this->fieldName, 'type' => 'text', 'cardinality' => 1, 'translatable' => TRUE, - ); - field_create_field($field); - - $instance = array( + ))->save(); + entity_create('field_instance', array( 'entity_type' => $this->entityType, 'field_name' => $this->fieldName, 'bundle' => $this->bundle, 'label' => 'Test translatable text-field', - ); - field_create_instance($instance); + ))->save(); entity_get_form_display($this->entityType, $this->bundle, 'default') ->setComponent($this->fieldName, array( 'type' => 'text_textfield', diff --git a/core/modules/translation_entity/translation_entity.admin.inc b/core/modules/translation_entity/translation_entity.admin.inc index dd7874c..57bb727 100644 --- a/core/modules/translation_entity/translation_entity.admin.inc +++ b/core/modules/translation_entity/translation_entity.admin.inc @@ -462,7 +462,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 bbe6605..5800198 100644 --- a/core/modules/translation_entity/translation_entity.module +++ b/core/modules/translation_entity/translation_entity.module @@ -1027,7 +1027,7 @@ function translation_entity_save_settings($settings) { else { unset($instance['settings']['translation_sync']); } - field_update_instance($instance); + $instance->save(); } } }