Extending blueprints

Hello,

I try to add some configuration options to site.yaml. and to organize them.

Thanks to this page :
https://learn.getgrav.org/forms/blueprints/example-config-blueprints
I was able to do that :

@extends:
    '@parent'

form:
    fields:
        socials:
            type: section
            title: Réseaux sociaux
            underline: true
            fields:
              facebook:
                  type: text
                  label: Facebook
                  size: large
              youtube:
                  type: text
                  label: Youtube
                  size: large 

Wich output

facebook: ''
youtube: ''

My desired output is :

socials :
    facebook: ''
    youtube: ''

So I could access them via {{config.site.socials.facebook}} and not {{config.site.facebook}}

Could anyone give me a hint ? :slight_smile:

Hi,
I think you just need to add socialsas an additional level before facebooketc. because the type sectionis a purely visual grouping in the admin.
So, if you do:

form:
    fields:
        socials:
            type: section
            title: Réseaux sociaux
            underline: true
            fields:
               socials:
                 facebook:
                    type: text
                    label: Facebook
                    size: large
                 youtube:
                    type: text
                    label: Youtube
                    size: large 

you should be good to go :wink:

Thank you for your time.

I tried, but then, in the admin panel my new fields won’t show up.
I have the title of the section, but no fields.
Admin panel without fields

Hmm, you’re right, this does not work for me too…
What works for me is:

form:
    fields:
        socials:
            type: section
            title: Réseaux sociaux
            underline: true
            fields:
               socials.facebook:
                  type: text
                  label: Facebook
                  size: large
               socials.youtube:
                  type: text
                  label: Youtube
                  size: large

Oh great, that’s perfect !
This way I’ll be able to keep a comprehensible structure.

Thank you very much. :slight_smile:

Glad I could help :slight_smile: