Theme dependencies break config install or config import

Created on 9 September 2020, about 4 years ago
Updated 8 February 2023, almost 2 years ago

Hi, sorry for my bad english.

Problem/Motivation

The modules listed as dependencies in bootstrap_italia.info.yml break a drupal installation by config or a config import (when the theme is not enabled)

this error is printed:

 [error]  Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization.
Unable to install the <em class="placeholder">Bootstrap Italia</em> theme since it requires the <em class="placeholder"></em> theme.
Unable to install the <em class="placeholder">Bootstrap Italia</em> theme since it requires the <em class="placeholder"></em> theme.
Unable to install the <em class="placeholder">Bootstrap Italia</em> theme since it requires the <em class="placeholder"></em> theme.

Steps to reproduce

  • Install drupal
  • install this theme and enable it with the admin panel
  • export configs with drush
  • uninstall the theme with the admin panel
  • import configs with drush

I expect the theme to be enabled automatically, but I get the error shown above

same thing installing drupal with config install like:
drush site:install ...... --existing-config

Proposed resolution

I think the problem is on the core, but I can bypass the problem by removing module dependencies from the theme (as a workaround)

I didn't go into the core problem because I don't have enough time right now, but the offending code is in the method validateThemes() on ConfigImportSubscriber

    // Ensure that all themes being installed have their dependencies met.
    foreach ($installs as $theme) {
      foreach (array_keys($theme_data[$theme]->requires) as $required_theme) {
        if (!isset($core_extension['theme'][$required_theme])) {
          $theme_name = $theme_data[$theme]->info['name'];
          $required_theme_name = $theme_data[$required_theme]->info['name'];
          $config_importer->logError($this->t('Unable to install the %theme theme since it requires the %required_theme theme.', ['%theme' => $theme_name, '%required_theme' => $required_theme_name]));
        }
      }
    }

and the check in if (!isset($core_extension['theme'][$required_theme])) only considers themes, not modules.

P.S. I use drush 10.3.4

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: outdated

Version

0.0

Component

Code

Created by

🇮🇹Italy robertom

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024