1

For our Drupal sites we develop our own distribution. In the distribution are two themes (administration theme and custom base theme). The administration theme works, but the custom base theme cannot be found. When I try to install the theme with drush theme:enable our_base_theme -y, I get this error.

In ThemeInstaller.php line 136: Unknown themes: our_base_theme.

In admin/appearance, under the custom theme, which depends on the base custom theme, I see:

Requires: our_base_theme (missing)

This theme requires the listed modules to operate correctly.

With $themeHandler->getTheme('our_base_theme'); in Drupal Shell, I get:

Drupal\Core\Extension\Exception\UnknownExtensionException with message 'The theme our_base_theme does not exist.'

The themes are located at:

  • web/profiles/custom/our_profile/themes
    • our_admin_theme
    • our_base_theme

When I move the theme to web/themes/custom/our_base_theme, the theme can be found and works correctly.

I have already tried:

  • Clearing the cache

    drush cr
    
  • Reinstalling the Drupal files

    rm composer.lock
    composer install
    # or composer update
    
  • Setting file and folder permissions to avoid issues

    chmod -R 777 web/profiles/custom/our_profile/themes
    
  • Refreshing the theme data

    $themeHandler = \Drupal::service('theme_handler');
    $themeHandler->reset();
    $themeHandler->rebuildThemeData();
    $themeHandler->refreshInfo();
    
  • Changing the path in

    SELECT * FROM `key_value` WHERE `collection`='state' AND `name`='system.theme.files';
    

There is a similar issue, where the solution is to delete the hook_install() implementation, but we don't use that hook in our distribution.

I have found also a troubleshooting article, but none of the suggestions solved the issue.

1

1 Answer 1

1

This issue has been created during the migration of the old site (without the distribution) to the new site (with the distribution). Because of a lot of dependencies in the configurations, the migration has been divided in two stages. In the first stage (in old git repository) all new distribution modules and themes have been enabled, but without any configurations (the modules and themes in the old repository have only info files). In the second phase of the migration (in new git repository) have been the configurations imported.

The path to the installation profile in the old repository was: "web/profiles/our_profile", in the new repository: "web/profiles/custom/our_profile". After changing the path in the old repository to : "web/profiles/custom/our_profile", the theme works and can be found also after the migration.

I do not understand, why the issue effected only one theme and none of the modules.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.