Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

How to change the display order when extending a yaml?

Solved by Jason View solution

Started by Jason 4 years ago · 1 replies · 548 views
4 years ago

I'm extending the default yaml and would like to change the order the fields are displayed.

Right now, when I add new items, they appear on the bottom. I would like to change the order, so they make sense. Is that possible?
in my item.yaml I did this but it only added the new fields on the bottom:

YAML
extends@: default

form:
  fields:
    tabs:
      fields:
        content:
          fields:
            header.title:
              type: text
              autofocus: true
              style: vertical
              label: PLUGIN_ADMIN.TITLE

            header.subtitle:
              type: text
              autofocus: true
              style: vertical
              label: Subtitle

            header.subtitle2:
              type: text
              autofocus: true
              style: vertical
              label: Subtitle2

            content:
                type: markdown
                validate:
                  type: textarea

            header.media_order:
              type: pagemedia
              label: PLUGIN_ADMIN.PAGE_MEDIA

image|218x500

4 years ago Solution

Found it. Helps to RTFM. need to use "ordering@" to change the order. Now I'm happy.

https://learn.getgrav.org/17/forms/blueprints/advanced-features#changing-field-ordering

YAML
extends@: default

form:
  fields:
    tabs:
      fields:
        content:
          fields:

            header.h1title:
              ordering@: header.title #insert after title
              type: text
              autofocus: true
              style: vertical
              label: H1 Title

            header.subtitle:
              ordering@: header.h1title #instert after h1title
              type: text
              autofocus: true
              style: vertical
              label: Subtitle

Suggested topics

Topic Participants Replies Views Activity
Support · by complanar, 6 days ago
6 140 17 hours ago
Support · by Rick Beebe, 6 days ago
2 100 2 days ago
Support · by blu3prince, 3 days ago
0 52 3 days ago
Support · by alex, 4 days ago
2 92 3 days ago
Support · by Marcel, 2 weeks ago
1 143 4 days ago