diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php index 0466568..b2de855 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php @@ -72,7 +72,7 @@ public function testBlockFields() { )); $this->field->save(); $this->instance = entity_create('field_instance', array( - 'field_name' => $this->field->getFieldName(), + 'field_name' => $this->field->name, 'entity_type' => 'custom_block', 'bundle' => 'link', 'settings' => array( diff --git a/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php b/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php index 1379a24..18e70af 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/Views/ContactFieldsTest.php @@ -48,7 +48,7 @@ protected function setUp() { $this->field->save(); entity_create('field_instance', array( - 'field_name' => $this->field->id(), + 'field_name' => $this->field->name, 'entity_type' => 'contact_message', 'bundle' => 'contact_message', ))->save(); @@ -67,7 +67,7 @@ public function testViewsData() { $expected = array('', '_value', '_format'); $this->assertEqual(count($data), count($expected), 'The expected amount of array keys were found.'); foreach ($expected as $suffix) { - $this->assertTrue(isset($data[$this->field->id() . $suffix])); + $this->assertTrue(isset($data[$this->field->name . $suffix])); } $this->assertTrue(empty($data['table']['join']), 'The field is not joined to the non existent contact message base table.'); } diff --git a/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php b/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php index 14bbf1f..3c739be 100644 --- a/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php +++ b/core/modules/datetime/lib/Drupal/datetime/Tests/DatetimeFieldTest.php @@ -64,7 +64,7 @@ function setUp() { )); $this->field->save(); $this->instance = entity_create('field_instance', array( - 'name' => $this->field->id(), + 'field_name' => $this->field->name, 'entity_type' => 'entity_test', 'bundle' => 'entity_test', 'settings' => array( @@ -74,7 +74,7 @@ function setUp() { $this->instance->save(); entity_get_form_display($this->instance->entity_type, $this->instance->bundle, 'default') - ->setComponent($this->field->id(), array( + ->setComponent($this->field->name, array( 'type' => 'datetime_default', )) ->save(); @@ -85,7 +85,7 @@ function setUp() { 'settings' => array('format_type' => 'medium'), ); entity_get_display($this->instance->entity_type, $this->instance->bundle, 'full') - ->setComponent($this->field->id(), $this->display_options) + ->setComponent($this->field->name, $this->display_options) ->save(); } @@ -93,7 +93,7 @@ function setUp() { * Tests date field functionality. */ function testDateField() { - $field_name = $this->field->id(); + $field_name = $this->field->name; // Display creation form. $this->drupalGet('entity_test/add'); @@ -161,7 +161,7 @@ function testDateField() { * Tests date and time field. */ function testDatetimeField() { - $field_name = $this->field->id(); + $field_name = $this->field->name; // Change the field to a datetime field. $this->field['settings']['datetime_type'] = 'datetime'; $this->field->save(); @@ -230,7 +230,7 @@ function testDatetimeField() { * Tests Date List Widget functionality. */ function testDatelistWidget() { - $field_name = $this->field->id(); + $field_name = $this->field->name; // Change the field to a datetime field. $this->field->settings['datetime_type'] = 'datetime'; $this->field->save(); @@ -300,7 +300,7 @@ function testDefaultValue() { // Change the field to a datetime field. $this->field->settings['datetime_type'] = 'datetime'; $this->field->save(); - $field_name = $this->field->id(); + $field_name = $this->field->name; // Set the default value to 'now'. $this->instance->settings['default_value'] = 'now'; @@ -342,7 +342,7 @@ function testInvalidField() { // Change the field to a datetime field. $this->field->settings['datetime_type'] = 'datetime'; $this->field->save(); - $field_name = $this->field->id(); + $field_name = $this->field->name; // Display creation form. $this->drupalGet('entity_test/add'); diff --git a/core/modules/entity_reference/entity_reference.module b/core/modules/entity_reference/entity_reference.module index 718bfa8..413fee1 100644 --- a/core/modules/entity_reference/entity_reference.module +++ b/core/modules/entity_reference/entity_reference.module @@ -425,6 +425,7 @@ function entity_reference_create_instance($entity_type, $bundle, $field_name, $f if (empty($instance)) { $instance = array( 'field_name' => $field_name, + 'entity_type' => $entity_type, 'bundle' => $bundle, 'label' => $field_label, 'settings' => array( diff --git a/core/modules/field/field.install b/core/modules/field/field.install index 5bbfef4..4999847 100644 --- a/core/modules/field/field.install +++ b/core/modules/field/field.install @@ -308,7 +308,7 @@ function field_update_8003() { $field_data = array(); // Migrate field definitions. - $records = db_query("SELECT DISTINCT entity_type, fc.* FROM {field_config} fc INNER JOIN {field_config_instance} fci ON fc.field_id = fci.field_id")->fetchAll(PDO::FETCH_ASSOC); + $records = db_query("SELECT DISTINCT entity_type, fc.* FROM {field_config} fc INNER JOIN {field_config_instance} fci ON fc.id = fci.field_id")->fetchAll(PDO::FETCH_ASSOC); foreach ($records as $record) { $record['data'] = unserialize($record['data']); diff --git a/core/modules/field/field.module b/core/modules/field/field.module index bb34626..120368c 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -306,7 +306,7 @@ function field_entity_field_info($entity_type) { function _field_generate_entity_field_definition(FieldInterface $field, FieldInstanceInterface $instance = NULL) { // @todo: Allow for adding field type settings. $definition = array( - 'label' => t('Field !name', array('!name' => $field->getFieldName())), + 'label' => t('Field !name', array('!name' => $field->name)), 'type' => 'field_item:' . $field->type, 'list' => TRUE, 'configurable' => TRUE, diff --git a/core/modules/field/lib/Drupal/field/Tests/ActiveTest.php b/core/modules/field/lib/Drupal/field/Tests/ActiveTest.php index 9eb25ba..d0053ff 100644 --- a/core/modules/field/lib/Drupal/field/Tests/ActiveTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/ActiveTest.php @@ -37,7 +37,7 @@ function testActive() { // Test disabling and enabling the field type module, $modules = array('field_test'); - $field_name = $field_definition['field_name']; + $field_name = $field_definition['name']; // Read the field. $field = field_read_field('entity_test', $field_name); diff --git a/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php b/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php index 51b89f4..8c66ab1 100644 --- a/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php @@ -135,7 +135,7 @@ function setUp() { foreach ($this->bundles as $bundle) { foreach ($this->fields as $field) { entity_create('field_instance', array( - 'field_name' => $field->getFieldName(), + 'field_name' => $field->name, 'entity_type' => $this->entity_type, 'bundle' => $bundle, ))->save(); @@ -166,7 +166,7 @@ function setUp() { function testDeleteFieldInstance() { $bundle = reset($this->bundles); $field = reset($this->fields); - $field_name = $field->getFieldName(); + $field_name = $field->name; $factory = \Drupal::service('entity.query'); // There are 10 entities of this bundle. @@ -176,7 +176,7 @@ function testDeleteFieldInstance() { $this->assertEqual(count($found), 10, 'Correct number of entities found before deleting'); // Delete the instance. - $instance = field_info_instance($this->entity_type, $field->getFieldName(), $bundle); + $instance = field_info_instance($this->entity_type, $field->name, $bundle); $instance->delete(); // The instance still exists, deleted. @@ -217,7 +217,7 @@ protected function checkFieldTableContents(FieldInterface $field) { ->fields('t', array_keys($schema[$table]['fields'])) ->execute(); foreach ($result as $row) { - $this->assertEqual($this->entities[$row->entity_id]->{$field->getFieldName()}->value, $row->$column); + $this->assertEqual($this->entities[$row->entity_id]->{$field->name}->value, $row->$column); } } @@ -233,7 +233,7 @@ function testPurgeInstance() { $field = reset($this->fields); // Delete the instance. - $instance = field_info_instance($this->entity_type, $field->getFieldName(), $bundle); + $instance = field_info_instance($this->entity_type, $field->name, $bundle); $instance->delete(); // No field hooks were called. @@ -248,7 +248,7 @@ function testPurgeInstance() { // There are $count deleted entities left. $found = \Drupal::entityQuery('entity_test') ->condition('type', $bundle) - ->condition($field->getFieldName() . '.deleted', 1) + ->condition($field->name . '.deleted', 1) ->execute(); $this->assertEqual(count($found), $count, 'Correct number of entities found after purging 2'); } @@ -292,7 +292,7 @@ function testPurgeField() { // Delete the first instance. $bundle = reset($this->bundles); - $instance = field_info_instance($this->entity_type, $field->getFieldName(), $bundle); + $instance = field_info_instance($this->entity_type, $field->name, $bundle); $instance->delete(); // Assert that hook_field_delete() was not called yet. @@ -322,7 +322,7 @@ function testPurgeField() { // Delete the second instance. $bundle = next($this->bundles); - $instance = field_info_instance($this->entity_type, $field->getFieldName(), $bundle); + $instance = field_info_instance($this->entity_type, $field->name, $bundle); $instance->delete(); // Assert that hook_field_delete() was not called yet. diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldAccessTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldAccessTest.php index 7af06aa..eb115dc 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldAccessTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldAccessTest.php @@ -58,7 +58,7 @@ function setUp() { ); entity_create('field_entity', $field)->save(); $instance = array( - 'field_name' => $field['field_name'], + 'field_name' => $field['name'], 'entity_type' => 'node', 'bundle' => $content_type, ); @@ -67,7 +67,7 @@ function setUp() { // Assign display properties for the 'default' and 'teaser' view modes. foreach (array('default', 'teaser') as $view_mode) { entity_get_display('node', $content_type, $view_mode) - ->setComponent($field['field_name']) + ->setComponent($field['name']) ->save(); } diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php index b5aba10..b79379b 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php @@ -122,7 +122,7 @@ function testFieldPrepare() { // Simulate a stored field definition missing a field setting (e.g. a // third-party module adding a new field setting has been enabled, and // existing fields do not know the setting yet). - \Drupal::config('field.field.' . $field->getFieldName()) + \Drupal::config('field.field.' . $field->id()) ->set('settings', array()) ->save(); field_info_cache_clear(); diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php index 2a3ddac..531dfed 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php @@ -51,7 +51,8 @@ function setUp() { $this->field = entity_create('field_entity', $this->field_definition); $this->field->save(); $this->instance_definition = array( - 'field_name' => $this->field['field_name'], + 'field_name' => $this->field->name, + 'entity_type' => 'entity_test', 'bundle' => 'entity_test', ); } diff --git a/core/modules/field/lib/Drupal/field/Tests/FormTest.php b/core/modules/field/lib/Drupal/field/Tests/FormTest.php index cabb961..3c4944c 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FormTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FormTest.php @@ -93,7 +93,7 @@ function setUp() { function testFieldFormSingle() { $field = $this->field_single; - $field_name = $field['field_name']; + $field_name = $field['name']; $this->instance['field_name'] = $field_name; entity_create('field_entity', $field)->save(); entity_create('field_instance', $this->instance)->save(); @@ -176,7 +176,7 @@ function testFieldFormSingle() { */ function testFieldFormDefaultValue() { $field = $this->field_single; - $field_name = $field['field_name']; + $field_name = $field['name']; $this->instance['field_name'] = $field_name; $default = rand(1, 127); $this->instance['default_value'] = array(array('value' => $default)); @@ -208,7 +208,7 @@ function testFieldFormDefaultValue() { function testFieldFormSingleRequired() { $field = $this->field_single; - $field_name = $field['field_name']; + $field_name = $field['name']; $this->instance['field_name'] = $field_name; $this->instance['required'] = TRUE; entity_create('field_entity', $field)->save(); @@ -345,7 +345,7 @@ function testFieldFormUnlimited() { function testFieldFormMultivalueWithRequiredRadio() { // Create a multivalue test field. $field = $this->field_unlimited; - $field_name = $field['field_name']; + $field_name = $field['name']; $this->instance['field_name'] = $field_name; entity_create('field_entity', $field)->save(); entity_create('field_instance', $this->instance)->save(); diff --git a/core/modules/field/lib/Drupal/field/Tests/NestedFormTest.php b/core/modules/field/lib/Drupal/field/Tests/NestedFormTest.php index 3d180f6..e812ff5 100644 --- a/core/modules/field/lib/Drupal/field/Tests/NestedFormTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/NestedFormTest.php @@ -33,8 +33,17 @@ public function setUp() { $web_user = $this->drupalCreateUser(array('view test entity', 'administer entity_test content')); $this->drupalLogin($web_user); - $this->field_single = array('field_name' => 'field_single', 'type' => 'test_field'); - $this->field_unlimited = array('field_name' => 'field_unlimited', 'type' => 'test_field', 'cardinality' => FIELD_CARDINALITY_UNLIMITED); + $this->field_single = array( + 'name' => 'field_single', + 'entity_type' => 'entity_test', + 'type' => 'test_field', + ); + $this->field_unlimited = array( + 'name' => 'field_unlimited', + 'entity_type' => 'entity_test', + 'type' => 'test_field', + 'cardinality' => FIELD_CARDINALITY_UNLIMITED, + ); $this->instance = array( 'entity_type' => 'entity_test', diff --git a/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php b/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php index a176978..7b6ce22 100644 --- a/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php @@ -246,7 +246,7 @@ function testFieldDisplayLanguage() { entity_create('field_entity', $field)->save(); $instance = array( - 'field_name' => $field['field_name'], + 'field_name' => $field['name'], 'entity_type' => $entity_type, 'bundle' => 'entity_test', ); diff --git a/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php b/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php index fce0a52..ba87735 100644 --- a/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php +++ b/core/modules/field_sql_storage/lib/Drupal/field_sql_storage/Tests/FieldSqlStorageTest.php @@ -464,36 +464,6 @@ function testFieldUpdateIndexesWithData() { } /** - * Test the storage details. - */ - function testFieldStorageDetails() { - $current = _field_sql_storage_tablename($this->field); - $revision = _field_sql_storage_revision_tablename($this->field); - - // Retrieve the field and instance with field_info so the storage details are attached. - $field = field_info_field($this->field_name); - $instance = field_info_instance($this->instance->entity_type, $field->id(), $this->instance->bundle); - - // The storage details are indexed by a storage engine type. - $storage_details = $field->getStorageDetails(); - $this->assertTrue(array_key_exists('sql', $storage_details), 'The storage type is SQL.'); - - // The SQL details are indexed by table name. - $details = $storage_details['sql']; - $this->assertTrue(array_key_exists($current, $details[FIELD_LOAD_CURRENT]), 'Table name is available in the instance array.'); - $this->assertTrue(array_key_exists($revision, $details[FIELD_LOAD_REVISION]), 'Revision table name is available in the instance array.'); - - // Test current and revision storage details together because the columns - // are the same. - $schema = $this->field->getSchema(); - foreach ($schema['columns'] as $column_name => $attributes) { - $storage_column_name = _field_sql_storage_columnname($this->field_name, $column_name); - $this->assertEqual($details[FIELD_LOAD_CURRENT][$current][$column_name], $storage_column_name, t('Column name %value matches the definition in %bin.', array('%value' => $column_name, '%bin' => $current))); - $this->assertEqual($details[FIELD_LOAD_REVISION][$revision][$column_name], $storage_column_name, t('Column name %value matches the definition in %bin.', array('%value' => $column_name, '%bin' => $revision))); - } - } - - /** * Test foreign key support. */ function testFieldSqlStorageForeignKeys() { diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php index 0d2199b..9d957c5 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php @@ -400,11 +400,11 @@ function testLockedField() { // Check that the links for edit and delete are not present. $this->drupalGet('admin/structure/types/manage/' . $this->type . '/fields'); - $locked = $this->xpath('//tr[@id=:field_name]/td[4]', array(':field_name' => $field->getFieldName())); + $locked = $this->xpath('//tr[@id=:field_name]/td[4]', array(':field_name' => $field->name)); $this->assertTrue(in_array('Locked', $locked), 'Field is marked as Locked in the UI'); - $edit_link = $this->xpath('//tr[@id=:field_name]/td[4]', array(':field_name' => $field->getFieldName())); + $edit_link = $this->xpath('//tr[@id=:field_name]/td[4]', array(':field_name' => $field->name)); $this->assertFalse(in_array('edit', $edit_link), 'Edit option for locked field is not present the UI'); - $delete_link = $this->xpath('//tr[@id=:field_name]/td[4]', array(':field_name' => $field->getFieldName())); + $delete_link = $this->xpath('//tr[@id=:field_name]/td[4]', array(':field_name' => $field->name)); $this->assertFalse(in_array('delete', $delete_link), 'Delete option for locked field is not present the UI'); } diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php index b1027f6..bda48d3 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php @@ -56,7 +56,7 @@ function testDefaultImages() { // Add another instance with another default image to the page content type. $instance2 = entity_create('field_instance', array( - 'field_name' => $field->getFieldName(), + 'field_name' => $field->name, 'entity_type' => 'node', 'bundle' => 'page', 'label' => $instance->label(), @@ -69,10 +69,10 @@ function testDefaultImages() { $widget_settings = entity_get_form_display($instance['entity_type'], $instance['bundle'], 'default')->getComponent($field['field_name']); entity_get_form_display('node', 'page', 'default') - ->setComponent($field->getFieldName(), $widget_settings) + ->setComponent($field->name, $widget_settings) ->save(); entity_get_display('node', 'page', 'default') - ->setComponent($field->getFieldName()) + ->setComponent($field->name) ->save(); // Confirm the defaults are present on the article field settings form. diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php index 5719f20..29943e8 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldTestBase.php @@ -80,7 +80,7 @@ function createImageField($name, $type_name, $field_settings = array(), $instanc entity_create('field_entity', $field)->save(); $instance = array( - 'field_name' => $field['field_name'], + 'field_name' => $field['name'], 'label' => $name, 'bundle' => $type_name, 'required' => !empty($instance_settings['required']), diff --git a/core/modules/node/node.module b/core/modules/node/node.module index d34b718..50beb5c 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -417,20 +417,20 @@ function node_add_body_field(NodeTypeInterface $type, $label = 'Body') { // Assign widget settings for the 'default' form mode. entity_get_form_display('node', $type->type, 'default') - ->setComponent($field->getFieldName(), array( + ->setComponent('body', array( 'type' => 'text_textarea_with_summary', )) ->save(); // Assign display settings for the 'default' and 'teaser' view modes. entity_get_display('node', $type->type, 'default') - ->setComponent($field->getFieldName(), array( + ->setComponent('body', array( 'label' => 'hidden', 'type' => 'text_default', )) ->save(); entity_get_display('node', $type->type, 'teaser') - ->setComponent($field->getFieldName(), array( + ->setComponent('body', array( 'label' => 'hidden', 'type' => 'text_summary_or_trimmed', )) diff --git a/core/modules/number/lib/Drupal/number/Tests/NumberFieldTest.php b/core/modules/number/lib/Drupal/number/Tests/NumberFieldTest.php index 8cc9cd3..ddf6469 100644 --- a/core/modules/number/lib/Drupal/number/Tests/NumberFieldTest.php +++ b/core/modules/number/lib/Drupal/number/Tests/NumberFieldTest.php @@ -73,13 +73,13 @@ function testNumberDecimalField() { )); $this->field->save(); entity_create('field_instance', array( - 'field_name' => $this->field->id(), + 'field_name' => $this->field->name, 'entity_type' => 'entity_test', 'bundle' => 'entity_test', ))->save(); entity_get_form_display('entity_test', 'entity_test', 'default') - ->setComponent($this->field->id(), array( + ->setComponent($this->field->name, array( 'type' => 'number', 'settings' => array( 'placeholder' => '0.00' @@ -87,7 +87,7 @@ function testNumberDecimalField() { )) ->save(); entity_get_display('entity_test', 'entity_test', 'default') - ->setComponent($this->field->id(), array( + ->setComponent($this->field->name, array( 'type' => 'number_decimal', )) ->save(); diff --git a/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php b/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php index ef20de5..a799441 100644 --- a/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php +++ b/core/modules/options/lib/Drupal/options/Tests/OptionsWidgetsTest.php @@ -111,13 +111,13 @@ function setUp() { function testRadioButtons() { // Create an instance of the 'single value' field. $instance = entity_create('field_instance', array( - 'field_name' => $this->card_1->id(), + 'field_name' => $this->card_1->name, 'entity_type' => 'entity_test', 'bundle' => 'entity_test', )); $instance->save(); entity_get_form_display('entity_test', 'entity_test', 'default') - ->setComponent($this->card_1->id(), array( + ->setComponent($this->card_1->name, array( 'type' => 'options_buttons', )) ->save(); @@ -170,13 +170,13 @@ function testRadioButtons() { function testCheckBoxes() { // Create an instance of the 'multiple values' field. $instance = entity_create('field_instance', array( - 'field_name' => $this->card_2->id(), + 'field_name' => $this->card_2->name, 'entity_type' => 'entity_test', 'bundle' => 'entity_test', )); $instance->save(); entity_get_form_display('entity_test', 'entity_test', 'default') - ->setComponent($this->card_2->id(), array( + ->setComponent($this->card_2->name, array( 'type' => 'options_buttons', )) ->save(); @@ -262,14 +262,14 @@ function testCheckBoxes() { function testSelectListSingle() { // Create an instance of the 'single value' field. $instance = entity_create('field_instance', array( - 'field_name' => $this->card_1->id(), + 'field_name' => $this->card_1->name, 'entity_type' => 'entity_test', 'bundle' => 'entity_test', 'required' => TRUE, )); $instance->save(); entity_get_form_display('entity_test', 'entity_test', 'default') - ->setComponent($this->card_1->id(), array( + ->setComponent($this->card_1->name, array( 'type' => 'options_select', )) ->save(); @@ -364,13 +364,13 @@ function testSelectListSingle() { function testSelectListMultiple() { // Create an instance of the 'multiple values' field. $instance = entity_create('field_instance', array( - 'field_name' => $this->card_2->id(), + 'field_name' => $this->card_2->name, 'entity_type' => 'entity_test', 'bundle' => 'entity_test', )); $instance->save(); entity_get_form_display('entity_test', 'entity_test', 'default') - ->setComponent($this->card_2->id(), array( + ->setComponent($this->card_2->name, array( 'type' => 'options_select', )) ->save(); @@ -486,12 +486,12 @@ function testSelectListMultiple() { function testOnOffCheckbox() { // Create an instance of the 'boolean' field. entity_create('field_instance', array( - 'field_name' => $this->bool->id(), + 'field_name' => $this->bool->name, 'entity_type' => 'entity_test', 'bundle' => 'entity_test', ))->save(); entity_get_form_display('entity_test', 'entity_test', 'default') - ->setComponent($this->bool->id(), array( + ->setComponent($this->bool->name, array( 'type' => 'options_onoff', )) ->save(); @@ -541,7 +541,7 @@ function testOnOffCheckbox() { $fieldUpdate['settings']['allowed_values'] = array(0 => 0, 1 => 'MyOnValue'); $fieldUpdate->save(); entity_create('field_instance', array( - 'field_name' => $this->bool->id(), + 'field_name' => $this->bool->name, 'entity_type' => 'node', 'bundle' => 'page', ))->save(); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php index 9c57d8b..37471d1 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php @@ -238,7 +238,7 @@ function testEnableModulesFixedList() { )); $field->save(); entity_create('field_instance', array( - 'field_name' => $field->getFieldName(), + 'field_name' => $field->name, 'entity_type' => 'entity_test', 'bundle' => 'entity_test', ))->save(); 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 0c8430d..4886c2b 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityQueryTest.php @@ -82,7 +82,7 @@ function setUp() { entity_test_create_bundle($bundle); foreach ($fields as $field) { entity_create('field_instance', array( - 'field_name' => $field->getFieldName(), + 'field_name' => $field->name, 'entity_type' => 'entity_test_mulrev', 'bundle' => $bundle, ))->save(); diff --git a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php index d42a65d..a17c6d1 100644 --- a/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php +++ b/core/modules/text/lib/Drupal/text/Tests/TextFieldTest.php @@ -59,7 +59,7 @@ function testTextFieldValidation() { )); $this->field->save(); entity_create('field_instance', array( - 'field_name' => $this->field->id(), + 'field_name' => $this->field->name, 'entity_type' => 'entity_test', 'bundle' => 'entity_test', ))->save(); @@ -67,8 +67,8 @@ function testTextFieldValidation() { // Test validation with valid and invalid values. $entity = entity_create('entity_test', array()); for ($i = 0; $i <= $max_length + 2; $i++) { - $entity->{$this->field->id()}->value = str_repeat('x', $i); - $violations = $entity->{$this->field->id()}->validate(); + $entity->{$this->field->name}->value = str_repeat('x', $i); + $violations = $entity->{$this->field->name}->validate(); if ($i <= $max_length) { $this->assertEqual(count($violations), 0, "Length $i does not cause validation error when max_length is $max_length"); } @@ -91,7 +91,6 @@ function testTextfieldWidgets() { */ function _testTextfieldWidgets($field_type, $widget_type) { // Setup a field and instance - $entity_type = 'entity_test'; $this->field_name = drupal_strtolower($this->randomName()); $this->field = entity_create('field_entity', array( 'name' => $this->field_name, diff --git a/core/modules/user/lib/Drupal/user/Tests/UserCreateTest.php b/core/modules/user/lib/Drupal/user/Tests/UserCreateTest.php index 2026e5c..0b898af 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserCreateTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserCreateTest.php @@ -40,7 +40,7 @@ protected function testUserAdd() { // Create a field and an instance. $field_name = 'test_field'; $field = array( - 'field_name' => $field_name, + 'name' => $field_name, 'module' => 'image', 'type' => 'image', 'cardinality' => 1, 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 0d4168c..c7ec4e0 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Wizard/TaggedWithTest.php @@ -109,7 +109,7 @@ function testTaggedWith() { $node_add_path = 'node/add/' . $this->node_type_with_tags->type; // Create three nodes, with different tags. - $tag_field = $this->tag_field->id() . '[' . Language::LANGCODE_NOT_SPECIFIED . ']'; + $tag_field = $this->tag_field->name . '[' . Language::LANGCODE_NOT_SPECIFIED . ']'; $edit = array(); $edit['title'] = $node_tag1_title = $this->randomName(); $edit[$tag_field] = 'tag1';