Skip to content
● Critical PHP security fixes are out: update PHP on your Grav sites. What to do →

Blueprints: how to override 'content'?

Solved by Paul Massendari View solution

Started by Oona O'Neil 9 years ago · 2 replies · 2069 views
9 years ago

I've only managed to add new fields to 'advanced' by using the example from learn.getgrav:
title: About
'@extends':
type: default
context: blueprints://pages

YAML
form:
  fields:
    tabs:
      fields:
        advanced:
          fields:
            overrides:
              fields:
                header.image:
                  type: mediapicker
                  folder: 'self@'
                  label: Image
                  preview_images: true
                  validate:
                    required: true

                header.sup:
                  type: text
                  label: Header_1
                  validate:
                    required: true

                header.heading:
                  type: text
                  label: Header_2
                  validate:
                    required: true

                header.text:
                  type: textarea
                  label: Main text
                  validate:
                    required: true

                header.icons:
                  type: list
                  style: vertical
                  label: Icons
                  fields:
                    .icon:
                      type: text
                      label: Font Awsome icon
                    .label:
                      type: text
                      label: Label

My logic is that I just replace 'advanced' with 'content', but it does not seem to work. Any guidance?

9 years ago Solution

You might be confused because the word "overrides" appears in the blueprint you pasted. However, this means this blueprint will append some fields to the "overrides" section which appears when you browse a page, under the advanced tab.
Here is how you can append some fields to the content tab:

YAML
title: About
’@extends’:
type: default
context: blueprints://pages

form:
  fields:
    tabs:
      fields:
        content:
          fields:
            header.mynewfield:
              type: text
              label: This is a new text field

I hope this answers your question.

👍 1

Suggested topics

Topic Participants Replies Views Activity
Forms & Blueprints · by TomW, 3 days ago
3 79 2 days ago
Forms & Blueprints · by Japhy, 3 weeks ago
2 394 2 weeks ago
Forms & Blueprints · by FrViPofm, 1 month ago
5 395 1 month ago
Forms & Blueprints · by Ton Haarmans, 6 years ago
13 2388 8 months ago
Forms & Blueprints · by Hugo Oliveira, 9 months ago
0 844 9 months ago