Irene Rojas
Irene Rojas

Reputation: 57

Drupal custom theme info.yml files crashes site

I am exploring custom theming in Drupal 9. I'm using MAMP and a fresh local install of Drupal. I cannot find a solution online for the following problem.

I created contrib and custom folders in themes/. I can put themes in the contrib folder and they appear in admin/appearance. So far, correct behavior. In custom, I made test/test.info.yml. This is the code:

name: Test
type: theme
description: 'Test theme'
core_version_requirement: ^8 || ^9

That's it. Everything online says those are the basic required keys.

When I go back to admin/appearance, the site crashes with error "The website encountered an unexpected error. Please try again later." Console shows "GET http://localhost:8888/admin/appearance 500 (500 Service unavailable (with message))"

As soon as I delete test.info.yml and refresh the browser, admin/appearance reappears. Even putting the test folder into contrib causes it to crash. I also moved a contrib module into custom, and it appeared as long as there was no test.info.yml file anywhere.

MAMP's php error log showed the following: "Uncaught PHP Exception Drupal\Core\Extension\InfoParserException: "Missing required key ("base theme") in themes/custom/test/test.info.yml"

Once I added a base theme, the theme appeared in admin/appearance.

Everything I've read says those four lines are the only thing required in a theme info.yml file. So why am I getting this error? I want to understand.

Upvotes: 0

Views: 1288

Answers (1)

2pha
2pha

Reputation: 10165

The base theme property in theme .info.yml files is now required.

Here is a link to the change record

Upvotes: 4

Related Questions