Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

How to make Array Form Field in Blueprint YAML

Started by Muut Archive 11 years ago · 4 replies · 545 views
11 years ago

I have this frontmatter on a page:

YAML
highlight:
  - header: Call to action
    text: "Put in some catchy words to let the viditors to your website know what to do and where to go to do this thing that they want to do."
    icon: life-saver
    url: about
  - header: This is the second
    text: "This would be another thing you can do, put in some information and let users find what they are looing for."
    icon: money
    url: join
  - header: And another
    text: "Here is another CTA, this is an important thing that you want people to see.  If they click, they will go there."
    icon: heart-o
    url: events

I would like to make this editable in the admin plugin so I made a blueprint file for the template and I want to add an Array or List that populates from the above frontmatter. I just don't know what the syntax would be.

YAML
            header.highlight: 
              type: array
              label: Home Page CTA
              options:
                header: header
                text: text
                icon: icon
                url: url

Obviously, that is wrong, it does populate an array of fields, but not correctly so it almost works.

11 years ago

Try this:

YAML
header.highlight:
              name: features
              type: list
              label: Home Page CTA

              fields:
                .icon:
                  type: text
                  label: Icon
                .header:
                  type: text
                  label: Header
                .text:
                  type: text
                  label: Text
                .url:
                  type: text 
                  label: Url
👍 1
11 years ago

One thing I notice is that the fields that come up are difficult to edit. I cannot place the mouse within the text of the textbox, I can only put my cursor at the beginning of the field and then I can use the arrow keys to move the cursor. Not a big deal, but confusing for someone who might want to edit text (non tech administrator). Should I report that as a bug on github?

11 years ago

Yah please report it as a bug, probably a CSS bug, but a bug none the less!

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1335 9 years ago
Archive · by Muut Archive, 9 years ago
2 925 9 years ago
Archive · by Muut Archive, 9 years ago
2 4056 9 years ago
Archive · by Muut Archive, 9 years ago
1 2940 9 years ago
Archive · by Muut Archive, 9 years ago
3 1112 9 years ago