diff --git a/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php b/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php index 12194a3..36a077c 100644 --- a/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php +++ b/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php @@ -232,6 +232,7 @@ public function __sleep() { // Only store the definition, not external objects or derived data. $keys = array_keys($this->toArray()); $keys[] = 'entityTypeId'; + $keys[] = 'enforceIsNew'; return $keys; } @@ -241,7 +242,9 @@ public function __sleep() { public function __wakeup() { // Run the values from self::toArray() through __construct(). $values = array_intersect_key($this->toArray(), get_object_vars($this)); + $is_new = $this->isNew(); $this->__construct($values, $this->entityTypeId); + $this->enforceIsNew($is_new); } /** diff --git a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php index 5a936ab..b5d370d 100644 --- a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php +++ b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php @@ -569,19 +569,6 @@ public function submitForm(array &$form, FormStateInterface $form_state) { /** * {@inheritdoc} */ - public function save(array $form, FormStateInterface $form_state) { - // Work around the fact that entity display are never guaranteed to be - // present, not even the 'default' one. - if (!$this->entityManager->getStorage($this->entity->getEntityTypeId())->load($this->entity->id())) { - $this->entity->enforceIsNew(); - } - - parent::save($form, $form_state); - } - - /** - * {@inheritdoc} - */ protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) { $form_values = $form_state->getValues(); diff --git a/core/modules/field_ui/src/Tests/FieldUIRouteTest.php b/core/modules/field_ui/src/Tests/FieldUIRouteTest.php index b97bc83..ac7d01f 100644 --- a/core/modules/field_ui/src/Tests/FieldUIRouteTest.php +++ b/core/modules/field_ui/src/Tests/FieldUIRouteTest.php @@ -65,6 +65,7 @@ public function testFieldUIRoutes() { $edit = array('display_modes_custom[register]' => TRUE); $this->drupalPostForm(NULL, $edit, t('Save')); + $this->assertResponse(200); $this->drupalGet('admin/config/people/accounts/form-display/register'); $this->assertTitle('Manage form display | Drupal'); $this->assertLocalTasks();