Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

How to change the display order when extending a yaml?

Solved by Jason View solution

Started by Jason 4 years ago · 1 replies · 741 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 TomW, 2 weeks ago
8 227 9 hours ago
Support · by alex, 2 months ago
8 667 23 hours ago
Support · by Supple, 5 days ago
1 98 1 day ago
Support · by TomW, 1 week ago
3 159 3 days ago
Support · by TomW, 6 days ago
2 106 5 days ago