Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 299183

Unable to uninstall base theme and subtheme at the same time

$
0
0

hi there,

while uninstalling themes during a config import (drush cim) I get the error message:
"The base theme $key cannot be uninstalled, because theme $sub_key depends on it."

but in the same config import I would also uninstall the sub theme.

on config import all the uninstalled themes should be in the same uninstall call, so that the test about
"Base themes cannot be uninstalled if sub themes are installed, and if they are not uninstalled at the same time." is possible.

/core/lib/Drupal/Core/Extension/ThemeInstaller.php Line 232:

      // Base themes cannot be uninstalled if sub themes are installed, and if
      // they are not uninstalled at the same time.
      // @todo https://www.drupal.org/node/474684 and
      //   https://www.drupal.org/node/1297856 themes should leverage the module
      //   dependency system.
      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.");
          }
        }
      }

as a temporary solution I replaced

            throw new \InvalidArgumentException("The base theme $key cannot be uninstalled, because theme $sub_key depends on it.");

with a recursive call

            $this->uninstall([$sub_key]);

thx for your ideas, feedbacks or long term fixes ;-)
cheers iwan

PS: I don't think, that this problem is covered with https://www.drupal.org/node/474684


Viewing all articles
Browse latest Browse all 299183

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>