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.

Support

How to change the display order when extending a yaml?

Solved by Jason View solution

Started by Jason 4 years ago · 1 replies · 395 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 Thomas, 1 week ago
2 60 16 hours ago
Support · by Anna, 3 days ago
2 66 19 hours ago
Support · by Justin Young, 20 hours ago
1 34 20 hours ago
Support · by Duc , 1 week ago
2 70 6 days ago
Support · by Colin Hume, 1 week ago
2 61 6 days ago