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.