0

I want to avoid using hook_install() so I can install from configuration.

I'd like my install profile to use seven for the admin theme, and my custom theme rutherford for the default/main frontend theme.

The annotated *.info.yml example on Drupal.org suggests that putting the following will install my themes:

# List any themes that should be installed as part of the profile installation.
# Note that this will not set any theme as the default theme.
themes:
  - rutherford
  - seven

My understanding of CMI is that I can then create a file called www/profiles/rocket/config/optional/system.theme.yml and put this in it to enable my themes:

admin: seven
default: rutherford

However none of this seems to work? My themes are found, but not installed or enabled:

The Drupal themes interface showing Rutherford and Seven as listed but not installed and not enabled

Edit:

I've just noticed that the themes are set as default and admin, they're just not installed:

Rutherford is listed with (default theme) next to it, and Seven wigth (administration theme) but neither are installed

6
  • I noticed that Lightning does this with a .profile file but I'd rather keep everything in config if possible, so that it's easier for colleagues (and future me) to find where different config settings are set. Sep 17, 2019 at 10:54
  • 1
    You can't be far off, that's exactly the same method the "standard" profile uses. The only difference is system.theme.yml is located in "config/install", not "config/optional" in core. Maybe that's the smoking gun
    – Clive
    Sep 17, 2019 at 11:09
  • @Clive Unfortunately I have the same problem if I put the theme config in www/profiles/rocket/config/install/system.theme.yml. I've based my profile off Standard but it seems to behave differently, for example copying the block.block.seven_breadcrumbs from www/core/profiles/standard/config/install/block.block.seven_breadcrumbs.yml and putting it in my profile's config/install directory gives me a UnmetDependencyException without fail, whereas Standard seems to get away with it somehow! Sep 17, 2019 at 11:19
  • Just updated my post to show that the themes are listed as being set as the default and admin themes, they just don't seem to be installed. Sep 17, 2019 at 11:27
  • 1
    Yeah I just checked some of my profiles, I'm using the theme installer manually in hook_install to get my themes installed too. Can't remember why, but I definitely would've tried to do it config first (my thought process is very similar to yours). Maybe there's a bug
    – Clive
    Sep 17, 2019 at 11:30

1 Answer 1

1

Ah 🤦‍♂️. Trying to install my rutherford theme via the web UI gave a The rutherford theme was not found. error message, so it seemed the theme was at fault, not the profile.

I inspected my theme's info file and realised it had a dependency which was not being met. Commenting out the dependency got everything working again!

It's a shame that the php www/core/scripts/drupal quick-start rocket did not give me any errors about this unmet theme dependency, otherwise I would have saved about six hours of trying various different configuration approaches! Ah well, ce la Drupal!

0

Your Answer

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

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