Third party settings in Drupal are very useful, but once you have installed them it can be a bit of a pain to remove them. They might be plugged into lots of different config files and some modules don't provide mechanisms to remove them once installed. This means that if you remove the module the third party settings might stick around and do nothing.
To remove third party settings from your site can either hand edit the configuration files (which I don't advise doing) or use an update hook to remove the settings from the configuration.
The following update hook assumes you need to remove the third party settings my_module:some-setting from your field config.
/**
* Remove all of the my_module:some-setting config from the site.
*/
function my_module_update_11001(&$sandbox = NULL) {
$fieldEntities = \Drupal::entityTypeManager()->getStorage('field_config')->loadMultiple();
foreach ($fieldEntities as $fieldId => $field) {
$fieldEntities[$fieldId]->unsetThirdPartySetting('my_module', 'some-setting');
$fieldEntities[$fieldId]->save();
}
}
Once you have run this update hook you just need to export the configuration of your site and you will see the third party settings being removed.
Add new comment