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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Forms & Blueprints

Extending a parent theme's configuration blueprint

blueprints theme

Started by Hugh Barnes 4 years ago · 2 replies · 531 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 Hugh Barnes
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 Ton Haarmans, 5 years ago
13 1135 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 60 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 132 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 108 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 127 7 months ago