diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchMultilingualEntityTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchMultilingualEntityTest.php index e9526d8..b392277 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchMultilingualEntityTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchMultilingualEntityTest.php @@ -50,7 +50,7 @@ function setUp() { // The parent class has already created the article and page content types. $field = field_info_field('body'); $field['translatable'] = TRUE; - field_update_field($field); + $field->save(); // Create a few page nodes with multilingual body values. $default_format = filter_default_format(); diff --git a/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php b/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php index 33802db..84ea739 100644 --- a/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php +++ b/core/modules/serialization/lib/Drupal/serialization/Tests/EntitySerializationTest.php @@ -60,12 +60,12 @@ protected function setUp() { $this->installSchema('entity_test', array('entity_test_mulrev', 'entity_test_mulrev_property_revision', 'entity_test_mulrev_property_data')); // Auto-create a field for testing. - field_create_field(array( + entity_create('field_entity', array( 'field_name' => 'field_test_text', 'type' => 'text', 'cardinality' => 1, 'translatable' => FALSE, - )); + ))->save(); $instance = array( 'entity_type' => 'entity_test_mulrev', 'field_name' => 'field_test_text', @@ -76,7 +76,7 @@ protected function setUp() { 'weight' => 0, ), ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); // Create a test entity to serialize. $this->values = array( diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php index 2379193..50049ad 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php @@ -235,13 +235,13 @@ function testEnableModulesFixedList() { 'field_name' => 'test_field', 'type' => 'test_field' ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $instance = array( 'field_name' => $field['field_name'], 'entity_type' => 'entity_test', 'bundle' => 'entity_test', ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); } /** diff --git a/core/modules/system/lib/Drupal/system/Tests/Ajax/MultiFormTest.php b/core/modules/system/lib/Drupal/system/Tests/Ajax/MultiFormTest.php index c9e7b6d..3d8d92c 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Ajax/MultiFormTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Ajax/MultiFormTest.php @@ -39,13 +39,13 @@ function setUp() { 'type' => 'text', 'cardinality' => FIELD_CARDINALITY_UNLIMITED, ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $instance = array( 'field_name' => $field_name, 'entity_type' => 'node', 'bundle' => 'page', ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); // Login a user who can create 'page' nodes. $this->web_user = $this->drupalCreateUser(array('create page content')); diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php index 3c5679b..060a502 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFieldTest.php @@ -596,7 +596,7 @@ protected function assertComputedProperties($entity_type) { // Make the test text field processed. $instance = field_info_instance($entity_type, 'field_test_text', $entity_type); $instance['settings']['text_processing'] = 1; - field_update_instance($instance); + $instance->save(); $entity = $this->createTestEntity($entity_type); $entity->field_test_text->value = "The text text to filter."; diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryAggregateTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryAggregateTest.php index 54c6934..76cf7bd 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryAggregateTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryAggregateTest.php @@ -65,13 +65,13 @@ public function setUp() { 'type' => 'number_integer', 'cardinality' => 2, ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $instance = array( 'field_name' => $field['field_name'], 'entity_type' => 'entity_test', 'bundle' => 'entity_test', ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); } $entity = $this->entityStorageController->create(array( diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php index e6d796e..9da2c7e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryRelationshipTest.php @@ -85,14 +85,14 @@ public function setUp() { 'type' => 'taxonomy_term_reference', ); $field['settings']['allowed_values']['vocabulary'] = $vocabulary->id(); - field_create_field($field); + entity_create('field_entity', $field)->save(); // Third, create the instance. $instance = array( 'entity_type' => 'entity_test', 'field_name' => $this->fieldName, 'bundle' => 'entity_test', ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); // Create two terms and also two accounts. for ($i = 0; $i <= 1; $i++) { $term = entity_create('taxonomy_term', array( diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php index 958bfb5..25e3339 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php @@ -57,12 +57,13 @@ function setUp() { $figures = drupal_strtolower($this->randomName()); $greetings = drupal_strtolower($this->randomName()); foreach (array($figures => 'shape', $greetings => 'text') as $field_name => $field_type) { - $field = array( + $field = entity_create('field_entity', array( 'field_name' => $field_name, 'type' => $field_type, 'cardinality' => 2, - ); - $fields[] = field_create_field($field); + )); + $field->save(); + $fields[] = $field; } $bundles = array(); for ($i = 0; $i < 2; $i++) { @@ -78,7 +79,7 @@ function setUp() { 'entity_type' => 'test_entity', 'bundle' => $bundle, ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); } $bundles[] = $bundle; } @@ -393,7 +394,7 @@ protected function testCount() { 'entity_type' => 'test_entity_bundle', 'bundle' => $bundle, ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); $entity = entity_create('test_entity_bundle', array( 'ftid' => 1, diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php index 7672fbe..5d93f66 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationFormTest.php @@ -108,7 +108,7 @@ function testEntityFormLanguage() { // Make body translatable. $field = field_info_field('body'); $field['translatable'] = TRUE; - field_update_field($field); + $field->save(); $field = field_info_field('body'); $this->assertTrue($field['translatable'], 'Field body is translatable.'); diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php index f5c1c52..6730fac 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityTranslationTest.php @@ -56,7 +56,7 @@ function setUp() { 'cardinality' => 4, 'translatable' => TRUE, ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $this->field = field_read_field($this->field_name); // Create instance in all entity variations. @@ -66,7 +66,7 @@ function setUp() { 'entity_type' => $entity_type, 'bundle' => $entity_type, ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); $this->instance[$entity_type] = field_read_instance($entity_type, $this->field_name, $entity_type); } diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/ArbitraryRebuildTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/ArbitraryRebuildTest.php index 1604063..9726cfe 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/ArbitraryRebuildTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/ArbitraryRebuildTest.php @@ -39,7 +39,7 @@ function setUp() { 'cardinality' => -1, 'translatable' => FALSE, ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $instance = array( 'entity_type' => 'node', @@ -51,7 +51,7 @@ function setUp() { 'weight' => 0, ), ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); } /** diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/RebuildTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/RebuildTest.php index 3c0c0c5..571bb55 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/RebuildTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/RebuildTest.php @@ -76,13 +76,13 @@ function testPreserveFormActionAfterAJAX() { 'type' => 'text', 'cardinality' => FIELD_CARDINALITY_UNLIMITED, ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $instance = array( 'field_name' => $field_name, 'entity_type' => 'node', 'bundle' => 'page', ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); // Log in a user who can create 'page' nodes. $this->web_user = $this->drupalCreateUser(array('create page content')); diff --git a/core/modules/system/tests/modules/entity_test/entity_test.install b/core/modules/system/tests/modules/entity_test/entity_test.install index d0da050..49c5b5b 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.install +++ b/core/modules/system/tests/modules/entity_test/entity_test.install @@ -16,7 +16,7 @@ function entity_test_install() { 'cardinality' => 1, 'translatable' => FALSE, ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $entity_types = array( 'entity_test', @@ -35,7 +35,7 @@ function entity_test_install() { 'weight' => 0, ), ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); } } diff --git a/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php b/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php index 38ca376..c8612c3 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserRegistrationTest.php @@ -194,21 +194,21 @@ function testRegistrationDefaultValues() { */ function testRegistrationWithUserFields() { // Create a field, and an instance on 'user' entity type. - $field = array( + $field = entity_create('field_entity', array( 'type' => 'test_field', 'field_name' => 'test_user_field', 'cardinality' => 1, - ); - field_create_field($field); - $instance = array( + )); + $field->save(); + $instance = entity_create('field_instance', array( 'field_name' => 'test_user_field', 'entity_type' => 'user', 'label' => 'Some user field', 'bundle' => 'user', 'required' => TRUE, 'settings' => array('user_register_form' => FALSE), - ); - field_create_instance($instance); + )); + $instance->save(); // Check that the field does not appear on the registration form. $this->drupalGet('user/register'); @@ -216,7 +216,7 @@ function testRegistrationWithUserFields() { // Have the field appear on the registration form. $instance['settings']['user_register_form'] = TRUE; - field_update_instance($instance); + $instance->save(); $this->drupalGet('user/register'); $this->assertText($instance['label'], 'The field appears on user registration form'); @@ -244,7 +244,7 @@ function testRegistrationWithUserFields() { // Check that the 'add more' button works. $field['cardinality'] = FIELD_CARDINALITY_UNLIMITED; - field_update_field($field); + $field->save(); foreach (array('js', 'nojs') as $js) { $this->drupalGet('user/register'); // Add two inputs. diff --git a/core/modules/user/user.install b/core/modules/user/user.install index dca417c..616f84d 100644 --- a/core/modules/user/user.install +++ b/core/modules/user/user.install @@ -316,7 +316,7 @@ function user_install_picture_field() { 'default_image' => FALSE, ), ); - $field = field_create_field($field); + entity_create('field_entity', $field)->save(); $instance = array( 'field_name' => 'user_picture', @@ -345,7 +345,7 @@ function user_install_picture_field() { 'weight' => -1, ), ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); // Assign display settings for the 'default' and 'compact' view modes. entity_get_display('user', 'user', 'default') diff --git a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php index c4f90b8..6066c7c 100644 --- a/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/DefaultViewsTest.php @@ -72,7 +72,7 @@ protected function setUp() { ), ) ); - field_create_field($this->field); + entity_create('field_entity', $this->field)->save(); $this->instance = array( 'field_name' => $this->field_name, 'entity_type' => 'node', @@ -81,7 +81,7 @@ protected function setUp() { 'type' => 'options_select', ), ); - field_create_instance($this->instance); + entity_create('field_instance', $this->instance)->save(); entity_get_display('node', 'page', 'full') ->setComponent($this->field_name, array( 'type' => 'taxonomy_term_reference_link', diff --git a/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php b/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php index 7c150dc..10928be 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php @@ -66,7 +66,7 @@ function setUp() { ), ), ); - field_create_field($this->tag_field); + entity_create('field_entity', $this->tag_field)->save(); // Create an instance of the tag field on one of the content types, and // configure it to display an autocomplete widget. @@ -78,7 +78,7 @@ function setUp() { 'type' => 'taxonomy_autocomplete', ), ); - field_create_instance($this->tag_instance); + entity_create('field_instance', $this->tag_instance)->save(); entity_get_display('node', $this->node_type_with_tags->type, 'default') ->setComponent('field_views_testing_tags', array( @@ -184,7 +184,7 @@ function testTaggedWithByNodeType() { // "tagged with" form element should not appear for it too. $instance = $this->tag_instance; $instance['bundle'] = $this->node_type_without_tags->type; - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); $view['show[type]'] = $this->node_type_with_tags->type; $this->drupalPost('admin/structure/views/add', $view, t('Update "of type" choice')); $this->assertFieldByXpath($tags_xpath); diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install index a0594b0..76e49b1 100644 --- a/core/profiles/standard/standard.install +++ b/core/profiles/standard/standard.install @@ -108,7 +108,7 @@ function standard_install() { ), ), ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $help = st('Enter a comma-separated list of words to describe your content.'); $instance = array( @@ -122,7 +122,7 @@ function standard_install() { 'weight' => -4, ), ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); // Assign display settings for the 'default' and 'teaser' view modes. entity_get_display('node', 'article', 'default') @@ -157,7 +157,7 @@ function standard_install() { 'settings' => array(), ), ); - field_create_field($field); + entity_create('field_entity', $field)->save(); // Many of the following values will be defaulted, they're included here as an illustrative examples. @@ -189,7 +189,7 @@ function standard_install() { 'weight' => -1, ), ); - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); // Assign display settings for the 'default' and 'teaser' view modes. entity_get_display('node', 'article', 'default') diff --git a/core/scripts/generate-d7-content.sh b/core/scripts/generate-d7-content.sh index a19d329..1bf953d 100644 --- a/core/scripts/generate-d7-content.sh +++ b/core/scripts/generate-d7-content.sh @@ -93,7 +93,7 @@ ), ), ); - field_create_field($field); + entity_create('field_entity', $field)->save(); $node_types = $i > 11 ? array('page') : array_keys(node_type_get_types()); foreach ($node_types as $bundle) { $instance = array( @@ -132,7 +132,7 @@ 'settings' => array(), ); } - field_create_instance($instance); + entity_create('field_instance', $instance)->save(); } $parents = array(); // Vocabularies without hierarchy get one term, single parent vocabularies get