Score:0

A theme in a custom distribution isn't found

kp flag

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.

kp flag
Thanks @apaderno
Score:0
kp flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.