1

I've created a custom module in drupal 8 and on this module i've created:

  • Content types
  • Fields
  • Entities
  • Views ...

all this programmatically.

But the problem when i try to uninstall it the database keep all this forms stored !!!

I'm wondering if there is a solution to automatically delete them from database when uninstalling a module

I appreciate any kind of help :)

2

See How to delete a content type, programmatically?

You can add enforced dependencies on any config entity, if you do so, drupal will automatically remove them.

That's much better then using hook_uninstall(), as the user is informed about what will be removed on the uninstall confirm page.

0

Usually, you need to implement hook_uninstall to remove from the database all the information set by the module. It is not removed automatically.

Be aware that this hook needs to be implemented in the module's .install file, according to the documentation above.

  • should i set what to remove in my [link](hook_uninstall) such as field entities .. – user59552 Apr 18 '16 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.