How to extend a theme?

Was following theme inheritance post and after step 3 in Create Your New Theme I’ve got

RuntimeException (400)
Template "@images/grav-logo.svg" is not defined in "partials/logo.html.twig" at line 7.

Previous exceptions
* Template "@images/grav-logo.svg" is not defined in "partials/logo.html.twig" at line 7. (0)

Then noticed, that in Admin theme selection, the selected theme had no name (empty dropdown option was selected). Started digging and added a blueprint.yaml with:

name: myTheme
slug: mytheme

Then in Admin I see theme selected, but still the same error in front-end.
Any advice?

Trying to extend default v1.7.0-rc.20 Quark theme - want to add language picker

Not sure if this helps but noticed there is a logo path in the blueprint.yaml file.

Did you copy /user/themes/quark/blueprints.yaml file into /user/themes/mytheme/blueprints.yaml or create your own blueprint.yaml/

Didn’t help. Even copied logo itself to my theme and cleared caches, but still the same message :confused:

Did you see this post from earlier? Included grav-logo.svg missing on extending theme

pamtbaau wrote:
If the myquark.yaml is defined incorrectly, e.g. incorrect prefixes name, the Quark theme is not executed. ( /user/themes/mytheme/mytheme.yaml )
If file myquark.php is not present, the Quark theme is not executed.
If name of class in myquark.php is defined incorrectly, the Quark theme is not executed.

Sorry I am not more help… Just starting with Grav myself a couple days ago. I am trying to learn how to troubleshoot issues so I can use this for projects knowing that I can support it.

I just ran through Inheriting a theme manually and then using the DevTools.
Manually following the instructions did not work. Using the DevTools worked and the file content is different than what I had set up manually.

I would suggest using the DevTools and create the inherited child theme or a new inherited child theme to use as a template for future child themes.

Didn’t know about Dev tools. Looks like it did the job perfectly. Thank you

You’re welcome.
I am glad that helped.

Just wanted to add that the manual installation guide does work! So the “marked solution” is a bit misleading since it literally says: “the manual guide does not work, so use the plugin!”

This is problematic for two reasons:

(1) It’s just wrong, since the manual installation does work. After all, if that statement were true, then clearly the grav developers should take their manual installation guide offline… (And they didn’t since it is correct.)

(2) Some people (like me!) can’t use the plugin, since it literally requires terminal access to the server. I, for example, use grav and have full access to all files, but no access to a terminal, so I can’t use the plugin. (Although I can of course install it using the GUI admin tool, but actually using it still requires a terminal, so it can’t be used via GUI/browser, it only can be installed by it.

So let me give you the actual solution: Carefully double-check that you did painfully follow every single step in that manual installation guide. To cut things short, please read the very last entry (by pamtbaau from Aug’18) of the similar problem discussion, because it mentions some frequently made errors. (I believe that you can ignore all the fancy stuff above since for me the manual installation worked once I figured out my mistake.)

And to motivate my response: I actually had exactly the same error message after following the guide. I thought I followed it perfectly, but after reading that post I just linked I realized a “minor” mistake: When I copied the PHP code I didn’t realize that it mentions the class name (“class Mytheme extends Quark”), so my code literally contained the class name Mytheme instead of “Thenameofmythemethatiactuallydefined”. Once I changed the name the error message disappeared.

1 Like

Thank you, @ProfChaos.

You helped me resolve this utterly maddening Template "@images/my-logo.svg" is not defined in "partials/logo.html.twig" at line 7 error which seemed nearly impossible to diagnose.

When the hosting environment does not allow CLI, then manual code fixes are the only option.

I need to duplicate the Quark theme (or it could have been any other theme, really) to a new My-Theme folder, specifically eliminate any possibility for some third party to update the code because I expect to extensively replace whole templates, all CSS, et cetera to build a custom design which none of off-the-shelf themes easily allow for. It’s much better to simply build out my own templates based on my own existing HTML/CSS files, rather than some wonky system of child themes overwriting 95% of the Grav theme anyway.

In any event, your comment pointed me to the problem: the my-theme.php file had a line saying ‘class Quark extends theme’ which is what was breaking Grav with the silly logo error. By changing that line to become ‘class Mytheme extends theme’ the problem went away instantly and the logo which I defined in logo.html.twig suddenly appeared.

So, again, thank you for going out of your way to document your solution for those faced with hosting environments which do not allow ssh.