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() {
  • 2
    Configuration that your module depends on, which includes simple configuration that is prefxed with the name of your module, like mymodule.settings should automatically be uninstalled when the module is uninstalled.. Are you sure that's the name of your configuration? – Berdir Aug 3 '18 at 19:34
  • @Berdir when i did a config export the name of the configuration was mymodule.settings. – usernameabc Aug 3 '18 at 20:46
  • I disagree with being a duplicate. It's not about manually deleting the config, it's about ensuring that shouldn't be necessary. I'm not sure why it didn't work here, that's definitely how it is supposed to work. Try to reproduce with a simple module in a plain D8 site – Berdir Aug 3 '18 at 21:51
  • @Berdir i cleared my cache and it worked. sorry for the noob mistake there. – usernameabc Aug 3 '18 at 23:06

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.