Problem/Motivation
ModuleUninstallValidatorInterface services are the recommended way (see https://www.drupal.org/node/2392677) to prevent uninstalling a module if there are e.g. config dependencies that should avoid uninstalling the module.
However, we lack something similar for themes, while e.g. config can depend on themes and we might want to prevent uninstalling them.
Proposed resolution
Add ThemeUninstallValidatorInterface similar to ModuleUninstallValidatorInterface.
Evaluate if we can refactor ModuleUninstallValidatorInterface to use a common ExtensionUninstallValidatorInterface.
Remaining tasks
TBD
User interface changes
TBD
Introduced terminology
TBD
API changes
TBD
Data model changes
TBD
Release notes snippet
TBD
Issue fork drupal-3550019
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
wim leersThe absence of this is causing all config that depends on the theme to be deleted without warning! For module uninstallations causing config to be deleted, a detailed confirmation dialog is presented. The same should happen for theme uninstallations.
Comment #3
nicxvan commentedSo SDC's are available at all times if a theme is enabled, even if it's not in the active theme context?
Conceptually this makes sense if someone wants to start working on an MR.
Comment #5
cilefen commentedCould we rebrand it as ExtensionUninstallValidatorInterface?
Comment #6
nicxvan commented@cilefen good idea, but I don't think we want to do that.
Module and theme uninstall are different enough I think we want to keep these separate.
I'm not 100% convinced myself so if you have further thoughts please share.
Comment #7
catchNot really a normal feature request then, bumping to critical.
Comment #8
longwaveAs far as I can see the request here doesn't need a ThemeUninstallValidatorInterface, as this isn't done via an uninstall validator for modules.
ModuleUninstallConfirmForm::buildForm()shows the dependent entities:There is no such confirmation page for uninstalling a theme - a theme can be uninstalled from /admin/appearance with just a CSRF token.
Comment #9
longwaveWhich means this is probably a duplicate of #3096170: Add Confirmation Page for theme uninstall?
Comment #11
longwaveComment #12
nicxvan commentedAren't the validators about adding rules around uninstall? We need both right?
Comment #13
longwaveWell, we at least need the confirmation page first before we can even validate the uninstall I think? But module dependencies aren't handled through an uninstall validator anyway from what I saw.
Comment #14
nicxvan commentedYes, I think that is accurate!
My understanding is that it's just for checking a condition that has to pass before moduleUninstall is allowed.
This is for things beyond just module dependencies. For example the field module has one to prevent it's uninstall if there are still fields pending deletion.
Comment #15
longwaveBut is there any concrete use case for this for themes? So far I've only seen config dependencies requested, and the uninstall confirmation issue already handles that.
Comment #16
nicxvan commentedYou're most likely right, I could see some distros wanting to do this to prevent uninstall entirely, but you can still change defaults.
We can leave this pmni for a bit for feedback and close it if the confirmation page works.
Comment #17
nicxvan commentedI think it's safe to close this, the confirmation page has been in for a couple of months and it provides a dialog about the config.