Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Theme inheritance : default YAML settings inheritance?

Started by Muut Archive 10 years ago · 3 replies · 813 views
10 years ago

Hi everyone,

I started developing some websites with Grav, with the idea to create a “base theme” and then inherit from it and customize it for my various websites.

But I have some troubles with the default theme settings (yaml files) and twig. It seems like my child theme doesn’t inherit the default settings defined by the parent theme.

For example, my base theme is A and my child theme is B.

The default file "a.yaml" has the option “color: red”. And the child settings "b.yaml" doesn’t override this value (color is not defined at all).

According to the Theme-Configuration page (https://learn.getgrav.org/themes/theme-configuration), I expect to get the “red” string when I use Twig like this :

{{ grav.theme.config.color }}

But I get nothing...

What's the expected behavior regarding default settings when you inherit a theme ? Am I missing something ?

Remarks : I use grav v1.1.0-beta.5, so I think I can use {{ grav.theme.config.color }}, right ?

PS : Grav is awesome ;-)

10 years ago

I don't think theme configuration inheritance has ever been in Grav. Mainly its for twig templates

10 years ago

Thanks for the reply,

Okay so the configuration isn't inherited, but that's confusing for me. Especially that configuration inheritance is used in a lot of place in grav.

More over with this non-heritence I'll have to copy "a.yaml" to the "B" themes folder, and each time the base theme "A" will be updated I'll need to revew "b.yaml" in order to include the new settings, seems complicated... But I can live with that :)

Or maybe, do you have any plans to change this ?

10 years ago

Theme inheritence is not simply blueprint inheritance like most other areas of Grav, so it's not really the same thing.

It might be possible that we support inheritance of the form portion of the blueprint for other themes. This would mean you could define a default set of default form fields and inherit that. We have no immediate plans for this though as most themes don't even have configuration forms.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1366 9 years ago
Archive · by Muut Archive, 9 years ago
2 940 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2960 9 years ago
Archive · by Muut Archive, 9 years ago
3 1124 9 years ago