Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Extending a parent theme's configuration blueprint

blueprints theme

Started by hughbris 4 years ago · 2 replies · 1187 views
4 years ago

I have a theme "B" which extends "A". This is the first time I've tried theme blueprints. I added a form and field to A's blueprint under form: in themes/a/blueprints.yaml. It does not come up when I am editing B's configuration in Admin's "Themes" menu.

I tried this in themes/b/blueprints.yaml and it didn't work:

YAML
form:
  extends@: parent@

(in case anyone saw this in the first few minutes after posting, I edited this significantly, please reread)
(filenames corrected too after reading @pamtbaau's first response)

I could guess all kinds of crazy combinations of YAML syntax and might get lucky.

I also looked at events I might hook into but nothing seemed suitable and I don't know what I would change if I found one anyway.

I've extended page templates and blueprints easily enough, but can't find any guidance on theme blueprints.

last edited 06/05/22 by hughbris
4 years ago

@hughbris, Am I understanding correctly that you wish to inherit and extend file /user/themes/a/blueprints.yaml in /user/themes/b/blueprints.yaml by adding extra config fields?

I'm having the impression that it is not possible to inherit/extend the blueprints.yaml file, because the docs explicitly states to copy the form definition from the parent theme.

From section Inheriting using the CLI:

  1. Copy the “form” section from /user/themes/quark/blueprints.yaml file into /user/themes/mytheme/blueprints.yaml in order to include the customizable elements of the theme in the admin. (Or simply replace the file and edit its content.)

From section Inheriting manually:

  1. Copy the /user/themes/quark/blueprints.yaml file into /user/themes/mytheme/blueprints.yaml in order to include the customizable elements of the theme in the admin.
4 years ago

@pamtbaau:
Am I understanding correctly that you wish to inherit and extend file /user/themes/a/blueprints.yaml in /user/themes/b/blueprints.yaml

That's correct and you helped me see that I mentioned the wrong YAML filename in my question. Will correct that.

I agree that doesn't look promising. However, sometimes the docs don't get updated. Also, Grav usually follows DRY principles.

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by Anna, 2 days ago
2 53 16 hours ago
Forms & Blueprints · by Anna, 3 days ago
7 82 16 hours ago
Forms & Blueprints · by Anna, 1 week ago
5 186 6 days ago
Forms & Blueprints · by TomW, 1 month ago
3 379 1 month ago
Forms & Blueprints · by Japhy, 2 months ago
2 595 2 months ago