Problem/Motivation

After uninstalling the Language module, not all related display-configurations are removed from entity_view_display and entity_form_display config files.
You can trigger a good rebuild of the configurations if you go to the corresponding admin-ui form (/admin/structure/types/manage/page/fields) and save each view-mode separately.

Steps to reproduce

1. Do a new install with the "standard" profile
2. Export the config with $ drush config-export -> State 1
3. Enable the language module $ drush pm-enable language
4. Again export the config with $ drush config-export -> State 2
now

langcode:
    type: language_select
    weight: 2
    settings: {  }
    third_party_settings: {  }

is added to the config-file "core.entity_view_display.node.page.default" and "core.entity_form_display.node.page.default" (and other files).
5. Uninstall the language module $ drush pm-uninstall language
6. Again export the config with $ drush config-export -> State 3

The problem

State 3 is equal to State 2, but it should be equal to State 1.
This part

langcode:
    type: language_select
    weight: 2
    settings: {  }
    third_party_settings: {  }

is not removed, but it should be.

You can trigger a rebuild of "entity_view_display" and "entity_form_display" when you go to the admin-ui for those and save them.
For example /admin/structure/types/manage/page/fields for core.entity_form_display.node.page.default.

Proposed resolution

1. After uninstalling a module rebuild all entity_form_display and entity_view_display

Remaining tasks

User interface changes

API changes

Data model changes

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

ndf created an issue. See original summary.

ndf’s picture

Issue summary: View changes
ndf’s picture

Issue summary: View changes

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

rodrigoaguilera’s picture

Issue summary: View changes

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ndf’s picture

#2915036: Display mode configurations don't get updated with new fields contains code that rebuild the displays.
If that code is run when the language module is uninstalled, this issue is fixed.

In the #2915036: Display mode configurations don't get updated with new fields I proposed the add a service to the field module that rebuilds all displays.
This issue then can call that service upon uninstalling the language module (hook_uninstall())

...

function language_uninstall() {
  $display_rebuilder = \Drupal::service('field_display_rebuilder');
  $display_rebuilder->rebuildDisplays();
}

...

ndf’s picture

ndf’s picture

And the interdiff between the failing and combined patches in #10.

ndf’s picture

ndf’s picture

Title: Garbage in configuration files after uninstall module » Display configuration not fully removed after uninstalling Language module
Component: configuration system » field system
Issue summary: View changes

The last submitted patch, 12: drupal-2680939-12--failing-test-only.patch, failed testing. View results

ndf’s picture

Extended the tests to also test 'default' displays for both view-mode and form-mode.

#2915036: Display mode configurations don't get updated with new fields triggered a failure in a different test. The reason was saving of a 'default' form-mode in field_field_config_insert(). This is now solved with a parameter $include_default_displays to explicitly add parsing of default displays.

The last submitted patch, 15: drupal-2680939-15--failing-test-only.patch, failed testing. View results

ndf’s picture

Needs review.

drupal-2680939-15--service-approach.patch is green!
Also #2915036: Display mode configurations don't get updated with new fields#40 is green!

ndf’s picture

Status: Needs review » Postponed
Parent issue: » #2915036: Display mode configurations don't get updated with new fields

Postponed upon #2915036: Display mode configurations don't get updated with new fields
When the service is in, this issue can be fixed too.

I'll add combined patches here and in #2915036 to validate both.

ndf’s picture

ndf’s picture

Updated the combined patch [#2915036#comment-12411410]

ndf’s picture

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.