Problem/Motivation

The docblock in \Drupal\Core\Extension\ThemeInstallerInterface::uninstall Includes a not-entirely-accurate statement

   * @throws \InvalidArgumentException
   *   Thrown when trying to uninstall the default theme or the admin theme.


It says the exception is thrown when trying to uninstall the default theme or the admin theme, but this exception is ALSO thrown when trying to uninstall a theme that the default/admin theme depends on.

Proposed resolution

Update the docblock so it's clear the exception will also be thrown when trying to uninstall a theme that the default theme or admin theme depends on.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

bnjmnm created an issue. See original summary.

neelam_wadhwani’s picture

Assigned: Unassigned » neelam_wadhwani
Status: Active » Needs work
neelam_wadhwani’s picture

Assigned: neelam_wadhwani » Unassigned
Status: Needs work » Needs review
StatusFileSize
new760 bytes

Kindly review patch.
I have updated docblock.

cilefen’s picture

Category: Task » Bug report
Issue tags: +Quick fix, +Documentation
mradcliffe’s picture

Issue tags: +midcamp2020

Adding event tag.

The next step is to review the language in the uploaded patch.

martin107’s picture

Status: Needs review » Reviewed & tested by the community

This look like a good change to me.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

The update is not quite correct. The error is thrown for any base theme that has currently installed dependent theme is uninstalled. See the code:

      // Base themes cannot be uninstalled if sub themes are installed, and if
      // they are not uninstalled at the same time.
      if (!empty($list[$key]->sub_themes)) {
        foreach ($list[$key]->sub_themes as $sub_key => $sub_label) {
          if (isset($list[$sub_key]) && !in_array($sub_key, $theme_list, TRUE)) {
            throw new \InvalidArgumentException("The base theme $key cannot be uninstalled, because theme $sub_key depends on it.");
          }
        }
      }
avpaderno’s picture

Status: Needs work » Needs review
StatusFileSize
new717 bytes
alexpott’s picture

+++ b/core/lib/Drupal/Core/Extension/ThemeInstallerInterface.php
@@ -44,7 +44,7 @@ public function install(array $theme_list, $install_dependencies = TRUE);
-   *   Thrown when trying to uninstall the default theme or the admin theme.

Well this bit is true as well as the base theme thing. You can't uninstall the admin theme, the default theme or a theme that another theme depends on.

jungle’s picture

StatusFileSize
new762 bytes
-   *   Thrown when trying to uninstall a theme from which other themes depend.
+   *   Thrown when trying to uninstall the admin theme, the default theme or
+   *   a theme that another theme depends on.
avpaderno’s picture

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

lendude’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Bug Smash Initiative
StatusFileSize
new762 bytes

Re-upping @jungle's version in #10 since I like that wording better, to make clear that is the version I'm RTBCing

alexpott’s picture

Saving issue credit.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 17: 3121157-10.patch, failed testing. View results

  • alexpott committed 76aa51f on 10.1.x
    Issue #3121157 by apaderno, neelam_wadhwani, jungle, Lendude, alexpott,...

  • alexpott committed 8295e5d on 10.0.x
    Issue #3121157 by apaderno, neelam_wadhwani, jungle, Lendude, alexpott,...

  • alexpott committed 93ea807 on 9.5.x
    Issue #3121157 by apaderno, neelam_wadhwani, jungle, Lendude, alexpott,...
alexpott’s picture

Version: 9.5.x-dev » 9.4.x-dev
Status: Needs work » Fixed
Issue tags: -Quick fix

Committed and pushed 76aa51fdf9 to 10.1.x and 8295e5de71 to 10.0.x and 93ea80732b to 9.5.x and 3e872baf91 to 9.4.x. Thanks!

Backported to 9.4.x since this is a docs bug fix.

The fail was a random one.

  • alexpott committed 3e872ba on 9.4.x
    Issue #3121157 by apaderno, neelam_wadhwani, jungle, Lendude, alexpott,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.