1

I'm working on a local development environment (via Acquia Dev Desktop). Our theme is a subtheme of the Stack theme.

In this situation, I'm making changes to my .theme file, but they don't seem to be loading at all. If I make the same changes to the stack.theme, they load and work as expected.

I've ensured I'm using function <subtheme>_theme_suggestions_page_alter but still no luck. There is nothing in the error.log either.

4
  • 2
    Please, check if you have setted your sub-theme correctly according drupal.org/docs/8/theming-drupal-8/… . Especially check availability a string base theme: <your core theme machine name here> in your-theme.info.yml .
    – V.Vil
    Nov 27, 2017 at 16:54
  • Have you tried clearing your local cache? If you are looking for ways to troubleshoot, have you tried printing an HTML tag to the page or adding a log message using Drupal Watchdog in your page alter hook? This way you can log something like "hook ran" to see if it runs by checking your Watchdog log messages. Nov 27, 2017 at 19:11
  • Not sure if it was the cache, but per @V.Vil the sub-theme was setup correctly. I'd already tried clearing the caches, but no luck. I downloaded a fresh copy of the database from the Acquia environment, cleared the caches again, and it started working.
    – JMichael
    Jan 18, 2018 at 20:02
  • @JMichael in some situations i had to clear cache if i created a new hook. Updates tending to show up. Additional local setting can be drupal.org/node/2598914 Jan 18, 2018 at 22:27

1 Answer 1

5

Got it fixed on my local environment by putting the base theme name in quotes and then clearing the cache.

Changed base theme: classy to base theme: "classy".

Also, check for a single quote on your theme's description. If you find it, make sure you put the whole description in quotes.

7
  • 1
    No need of quotes. It should work without quotes as well. Oct 6, 2020 at 7:56
  • Can confirm this fixed an issue in my theme. Haven't dug into why, but it had me scratching my head when my preprocess function wasn't firing... sure enough, I had classy without quotes as the base theme. Jan 6, 2021 at 3:42
  • Thank you . This helped me to get my .theme file recognized. Without the double quotes the .theme file is ignored! I do not understand why. Is there any official Drupal issue about this?
    – drupalfan
    Mar 16, 2021 at 16:54
  • Quotes don't make a difference, but trailing whitespaces do! In Yaml something like key:value is the same as key: value, but key:value is NOT the same same as key:value
    – Hudri
    Apr 23, 2021 at 10:30
  • Thank you! My .theme file only started loading after putting classy in quotes (single quotes)! Weird. After getting it to load I could remove the quotes and it still works, so the actual mechanism must be something else. Apr 24, 2021 at 23:08

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.