How to delete configurations when module is uninstalled?

by usernameabc   Last Updated August 03, 2018 19:07 PM

We have a custom module mymodule that has the following structure. It basically has a configuration object that we are using in a mymodule_preprocess_node() call to do some logic and display certain output.

When the module is uninstalled, we noticed that configuration files are not deleted. How would we delete the configurations on uninstall?

What we were thinking, but not sure if that is correct or if we are missing any steps.

function mymodule_uninstall() {
  \Drupal::configFactory()->getEditable('mymodule.settings')->delete();
}


Related Questions





How to remove field from form and configuration?

Updated October 02, 2018 21:07 PM