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 8d49349..931f3ef 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 @@ -77,15 +77,18 @@ public function testBlockFields() { 'settings' => array( 'title' => DRUPAL_OPTIONAL, ), - 'widget' => array( - 'type' => 'link_default', - ), + ); + $form_display_options = array( + 'type' => 'link_default', ); $display_options = array( 'type' => 'link', 'label' => 'hidden', ); field_create_instance($this->instance); + entity_get_form_display('custom_block', 'link', 'default') + ->setComponent($this->field['field_name'], $form_display_options) + ->save(); entity_get_display('custom_block', 'link', 'default') ->setComponent($this->field['field_name'], $display_options) ->save(); diff --git a/core/modules/entity/entity.module b/core/modules/entity/entity.module index 84bb51e..96031c5 100644 --- a/core/modules/entity/entity.module +++ b/core/modules/entity/entity.module @@ -22,7 +22,7 @@ function entity_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) { foreach ($ids as $id) { $id = ConfigStorageController::getIDFromConfigName($id, $entity_info['config_prefix']); $display = entity_load('entity_display', $id); - $new_id = $entity_type . '.' . $bundle_new . '.' . $display->viewMode; + $new_id = $entity_type . '.' . $bundle_new . '.' . $display->mode; $display->id = $new_id; $display->bundle = $bundle_new; $display->save(); diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityFormDisplayTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityFormDisplayTest.php index ddf709c..25841ef 100644 --- a/core/modules/entity/lib/Drupal/entity/Tests/EntityFormDisplayTest.php +++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityFormDisplayTest.php @@ -24,12 +24,6 @@ public static function getInfo() { ); } - protected function setUp() { - parent::setUp(); - - $this->installSchema('field', array('field_config', 'field_config_instance')); - } - /** * Tests entity_get_form_display(). */ diff --git a/core/modules/field/field.install b/core/modules/field/field.install index 4cde970..1d8e1de 100644 --- a/core/modules/field/field.install +++ b/core/modules/field/field.install @@ -484,7 +484,6 @@ function field_update_8003() { 'default_value' => isset($record['data']['default_value']) ? $record['data']['default_value'] : array(), 'default_value_function' => isset($record['data']['default_value_function']) ? $record['data']['default_value_function'] : '', 'settings' => $record['data']['settings'], - 'widget' => $record['data']['widget'], 'status' => 1, 'langcode' => 'und', ); diff --git a/core/modules/field/lib/Drupal/field/Tests/FormTest.php b/core/modules/field/lib/Drupal/field/Tests/FormTest.php index 1932885..d684f7f 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FormTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FormTest.php @@ -614,10 +614,14 @@ function testFieldFormHiddenWidget() { $this->field = $this->field_single; $this->field_name = $this->field['field_name']; $this->instance['field_name'] = $this->field_name; - $this->instance['widget']['type'] = 'hidden'; $this->instance['default_value'] = array(0 => array('value' => 99)); field_create_field($this->field); field_create_instance($this->instance); + entity_get_form_display($this->instance['entity_type'], $this->instance['bundle'], 'default') + ->setComponent($this->instance['field_name'], array( + 'type' => 'hidden', + )) + ->save(); $langcode = LANGUAGE_NOT_SPECIFIED; // Display the entity creation form. @@ -636,8 +640,12 @@ function testFieldFormHiddenWidget() { // Update the instance to remove the default value and switch to the // default widget. $this->instance['default_value'] = NULL; - $this->instance['widget']['type'] = 'test_field_widget'; field_update_instance($this->instance); + entity_get_form_display($this->instance['entity_type'], $this->instance['bundle'], 'default') + ->setComponent($this->instance['field_name'], array( + 'type' => 'test_field_widget', + )) + ->save(); // Display edit form. $this->drupalGet('test-entity/manage/' . $id . '/edit'); @@ -652,9 +660,12 @@ function testFieldFormHiddenWidget() { $entity = field_test_entity_test_load($id); $this->assertEqual($entity->{$this->field_name}[$langcode][0]['value'], $value, 'Field value was updated'); - // Update the instance and switch to the Hidden widget again. - $this->instance['widget']['type'] = 'hidden'; - field_update_instance($this->instance); + // Update the form display and switch to the Hidden widget again. + entity_get_form_display($this->instance['entity_type'], $this->instance['bundle'], 'default') + ->setComponent($this->instance['field_name'], array( + 'type' => 'hidden', + )) + ->save(); // Create a new revision. $edit = array('revision' => TRUE); diff --git a/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php b/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php index 28b04cd..ebe6fc1 100644 --- a/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/PagePreviewTest.php @@ -76,20 +76,26 @@ function setUp() { 'field_name' => $this->field_name, 'entity_type' => 'node', 'bundle' => 'page', - 'widget' => array( - 'type' => 'options_select', - ), - // Hide on full display but render on teaser. - 'display' => array( - 'default' => array( - 'type' => 'hidden', - ), - 'teaser' => array( - 'type' => 'taxonomy_term_reference_link', - ), - ), ); field_create_instance($this->instance); + + entity_get_form_display('node', 'page', 'default') + ->setComponent($this->field['field_name'], array( + 'type' => 'options_select', + )) + ->save(); + + // Hide on full display but render on teaser. + entity_get_display('node', 'page', 'default') + ->setComponent($this->field['field_name'], array( + 'type' => 'hidden', + )) + ->save(); + entity_get_display('node', 'page', 'teaser') + ->setComponent($this->field['field_name'], array( + 'type' => 'taxonomy_term_reference_link', + )) + ->save(); } /**