diff --git a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php index d675cef262b350a1e4516f42b3b811ae776484e9..3ba0258a327097accf33f96f4112e8164dd918bf 100644 --- a/core/modules/field_ui/src/Form/EntityDisplayFormBase.php +++ b/core/modules/field_ui/src/Form/EntityDisplayFormBase.php @@ -567,7 +567,7 @@ protected function copyFormValuesToEntity(EntityInterface $entity, array $form, if ($form_state->get('plugin_settings_update') === $field_name) { // Only store settings actually used by the selected plugin. $default_settings = $this->pluginManager->getDefaultSettings($options['type']); - $options['settings'] = array_intersect_key($values['settings_edit_form']['settings'], $default_settings); + $options['settings'] = isset($values['settings_edit_form']['settings']) ? array_intersect_key($values['settings_edit_form']['settings'], $default_settings) : []; $options['third_party_settings'] = isset($values['settings_edit_form']['third_party_settings']) ? $values['settings_edit_form']['third_party_settings'] : []; $form_state->set('plugin_settings_update', NULL); } diff --git a/core/modules/field_ui/src/Tests/ManageDisplayTest.php b/core/modules/field_ui/src/Tests/ManageDisplayTest.php index 04a353fcbd6fb743cf5037a4f8b42cac6d277907..9ed319f2601be3ce8d46a17c6301d4c46449914d 100644 --- a/core/modules/field_ui/src/Tests/ManageDisplayTest.php +++ b/core/modules/field_ui/src/Tests/ManageDisplayTest.php @@ -163,6 +163,11 @@ function testFormatterUI() { $edit = array('fields[field_test][type]' => 'field_no_settings', 'refresh_rows' => 'field_test'); $this->drupalPostAjaxForm(NULL, $edit, array('op' => t('Refresh'))); $this->assertFieldByName('field_test_settings_edit'); + + // Make sure we can save the third party settings when there are no settings available + $this->drupalPostAjaxForm(NULL, array(), "field_test_settings_edit"); + $this->drupalPostAjaxForm(NULL, $edit, "field_test_plugin_settings_update"); + // Uninstall the module providing third party settings and ensure the button // is no longer there. \Drupal::service('module_installer')->uninstall(array('field_third_party_test'));