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

Blueprints: how to override 'content'?

Solved by Paul Massendari View solution

Started by Oona O'Neil 9 years ago · 2 replies · 1550 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 Ton Haarmans, 5 years ago
13 1138 4 months ago
Forms & Blueprints · by Hugo Oliveira, 5 months ago
0 61 5 months ago
Forms & Blueprints · by Flachy Joe, 6 months ago
9 135 6 months ago
Forms & Blueprints · by Augustus, 7 months ago
7 110 7 months ago
Forms & Blueprints · by Julien, 7 months ago
10 129 7 months ago