Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I enabled Classy theme and set default, after that I enabled Bartik to default and tried to uninstall Classy, but i see an error page, and I find a bug in php.log
[02-Oct-2014 12:42:35 Europe/Berlin] Uncaught PHP Exception InvalidArgumentException: "The base theme classy cannot be uninstalled, because theme bartik depends on it." at /Users/csakiistvan/drupal8/drupal/core/lib/Drupal/Core/Extension/ThemeHandler.php line 327
PHP version: 5.4.26
PS: the Classy them is missing from Component
Comment | File | Size | Author |
---|---|---|---|
#37 | i_can_not_uninstall-2348793-37.patch | 4.68 KB | nlisgo |
#26 | drupal8-2348793-25.patch | 4.67 KB | ACF |
#26 | drupal8-2348793-25-test-only.patch | 3.59 KB | ACF |
#11 | drupal8-2348793-11.patch | 1.76 KB | ACF |
#11 | drupal8-2348793-test-11.patch | 823 bytes | ACF |
Comments
Comment #1
Bojhan CreditAttribution: Bojhan commentedYhea, this is crtiical.
Comment #2
star-szrI'm not sure this is critical. The exception should be handled much better, sure, but if you have Bartik (or Seven) installed you cannot uninstall Classy because they depend on Classy.
Comment #3
star-szrComment #4
almaudoh CreditAttribution: almaudoh commentedMaybe the UI should disable the uninstall button for base themes when the sub-theme has been installed. Just like in the modules admin page.
Comment #5
Bojhan CreditAttribution: Bojhan commentedIt doesn't actually depend on it like modules do, as far as I know. So we just have to have a confirm button of - would you like to disable the base theme clasy too. What we do on the modules page is wrong!
Catch told me its critical. If you click a button, in a primary interface of Drupal and it trows a red flaming error - you have a critical bug.
Comment #6
inertialacoustic CreditAttribution: inertialacoustic commentedJust a quick link for everyone looking at this issue: https://www.drupal.org/node/474684. Snippet from code:
Comment #7
star-szrGood point :)
Comment #8
ACF CreditAttribution: ACF commentedIf the base theme of an admin theme can't be uninstalled, can't we remove the ability to install a theme if it's a base theme of an admin theme. Something like adding a conditional to the themepages method.
this is the code at the moment.
could change
to
Comment #9
larowlanComment #10
ACF CreditAttribution: ACF commentedComment #11
ACF CreditAttribution: ACF commentedI think this is the right way to go, i've added in a check to see on the admin page to check if the theme is either the base theme of an admin theme or of the default theme and if so the uninstall isn't displayed.
Comment #12
stBorchertReviewed the patch and tested on a fresh install.
Looks really good: the link to uninstall the base theme ("Classy") is gone and you cannot uninstall the theme anymore as long as any dependent theme is installed.
waiting for the testbot before setting to RTBC ...
Comment #13
csakiistvanI test it, works well
Comment #15
csakiistvanComment #16
stBorchert@ACF: could you reroll the test-patch? It seems to fail (guess the matching string is somehow not available).
Comment #17
ACF CreditAttribution: ACF commented@stBorchert The test patch is the test only without the change so it should fail, sorry it should be labelled test-only.
Comment #18
ACF CreditAttribution: ACF commentedComment #19
stBorchertAh. Well then https://www.drupal.org/files/issues/drupal8-2348793-11.patch is RTBC. Thanks for the patch and the clarification :)
Comment #20
alexpottCan we improve the the test so that we test that after uninstalling Bartik we can uninstall Classy. At the moment the test is very susceptible to false positives.
Comment #21
Bojhan CreditAttribution: Bojhan commentedWhat we should do is a confirm form, if you click on uninstalling Bartik you get a confirmation form to also disable the other themes. Why cant we do this?
Comment #22
star-szr@Bojhan, well if you are using Seven it would also require uninstalling Seven to uninstall Classy, so clicking uninstall on Bartik and confirming would remove Bartik, Seven, and Classy. Can we maybe discuss it more in a non-critical follow-up issue though?
I think this needs more work beyond test coverage because it's still pretty breakable:
Comment #23
davidhernandezYeah, agreeing with Cottser, this is a base theme dependency issue. Uninstalling all the other themes and base themes because you want to uninstall one is excessive. Just removing the uninstall link next to the base theme makes sense.
Comment #24
ACF CreditAttribution: ACF commentedYep it needs to check for whether those themes are installed. Just working on better test coverage and will change the fix.
Comment #25
Bojhan CreditAttribution: Bojhan commentedI am not really keen on doing "easy" fixes over "simple" fixes at this point in the release.
Because this simply introduces the issue, that people have no clue how to disable classy. By doing it as I propose you are aware of the affect. I am working on another issue, that we need to provide a separate style for base themes on the appearance page.
Comment #26
ACF CreditAttribution: ACF commentedOverrall, I think I agree that this is probably not the ideal fix, but i've added a fix and some updated test coverage in the hope it's of some use for a better fix.
Comment #27
davidhernandezI'm not seeing uninstalling all the other themes as something simple. That could have rather dramatic affects. Would it be reasonable to add text with the themes stating their dependencies and requirements, like we do with modules?
Requires: X
Required by: Y
Comment #28
star-szrMaybe there's some misunderstanding, so here's an attempt at thinking about ways we can always keep the Uninstall links.
This makes some sense to me:
Click Uninstall on Classy, be asked whether you want to uninstall Bartik, Seven, and any other installed themes that depend on Classy (because they need to be uninstalled first before you can uninstall Classy).
This doesn't:
Click Uninstall on Bartik, be asked whether you want to uninstall Bartik, Seven, Classy, and any other installed themes that depend on Classy (just because I want to uninstall Bartik doesn't mean I want to uninstall Classy, maybe I'm just switching to another base theme that extends from Classy).
Edit: And yes what @davidhernandez said seems like it could help clarify this to the end user.
Comment #29
star-szrSending #26 to testbot.
Comment #31
dawehnerI would not expect this behaviour given how
admin/modules/uninstall
works at the moment.Can't we just tell people why they cannot uninstall a specific theme?
Comment #32
LewisNymanIn my mind, the uninstall link would be styled as a disabled danger link from the style guide - https://groups.drupal.org/node/283223#Buttons
We could then add a tooltip that explains the reason it is disabled on hover.
Comment #33
sachbearbeiter CreditAttribution: sachbearbeiter commentedthis confused me too ...
but why an extra base theme? is this temporary?
otherwise it's totally not understandable to start a project like d8 with a transparent "helper" theme ...
Comment #34
LewisNymanComment #37
nlisgo CreditAttribution: nlisgo commentedRe-roll of https://www.drupal.org/files/issues/drupal8-2348793-25.patch
Comment #38
BarisW CreditAttribution: BarisW commentedThanks for the re-roll. Patch works as expected, the link to uninstall is gone.
Comment #39
alexpottCommitted f46096a and pushed to 8.0.x. Thanks!
Comment #42
csakiistvanGreat job guys, thanks.
Comment #43
MustangGB CreditAttribution: MustangGB commentedJust wanted to mention that nowhere in the UI does it give an indication that a theme is using another as it's base, or that this would mean it's uninstallable.
Would be nice if there was some text like "theme X is using the base theme Z", from this the user could infer that the base theme would be uninstallable.
Or "theme Z is uninstallable because it's being used by themes X and Y" on the base theme itself.
Comment #44
davidhernandezI believe that is being actively worked on here - #2372183: Display same info for themes as for modules
Comment #45
goose2000 CreditAttribution: goose2000 commentedI know this is closed but I had this issue, I could not install with drush and there was no UI to uninstall these. So I just copied the URL hovering over the uninstall bartik button:
https://invoice-bhs.blah.blah/admin/appearance/uninstall?theme=bartik&to...
and changed it to classy
https://invoice-bhs.blah.blah/admin/appearance/uninstall?theme=classy&to...
And it uninstalled fine.