In a custom module, I've set up a custom EntityMatcher in order to get suggestions for instances of my custom entity type in the linkit dialogue. This all works very fine.

However, when uninstalling my module, the configuration of any linkit profile that has my matcher is deleted and I cannot seem to find the reason for this.

My matcher is very simple and the linkit module does not seem to have functionality/hooks that would do this.

Has anyone else stumbled upon this?

  • This is caused by Drupal's configuration management and is working as intented. If another module/config/entity/whatever uses your matcher, it has a direct dependency on your module. Without this dependency, the other thing would be broken anyways.
    – Hudri
    Oct 18, 2023 at 9:21
  • @Hudri thank you for elaborating. The right thing to do, then, would be to have an uninstall hook in my module and, in this hook, remove any references to the matcher in profiles?
    – MSNOP
    Oct 18, 2023 at 9:46
  • 1
    IMHO no, it is the site admin's duty to check for dependencies between modules, before uninstalling them. The UI should list all additional configs which are deleted, before actually doing the uninstall. However, in the custom space, which only effects your own single project, you can basically do whatever fits your use-case.
    – Hudri
    Oct 18, 2023 at 11:11
  • @Hudri I also just realized that uninstalling via the GUI is not possible due to this and that the problem is explained when attempting to uninstall on /admin/modules/uninstall. Thank you for your time.
    – MSNOP
    Oct 18, 2023 at 11:27


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.