Grav: Does Grav support "structures" as seen in KirbyCMS

Created on 2 Apr 2019  路  6Comments  路  Source: getgrav/grav

KirbyCMS has a neat feature called "structures" essentially you define a custom content type in your yaml file and then you get a "add new" button that lets you add multiple of the same type.

https://getkirby.com/docs/reference/panel/fields/structure#example

Does Grav support this? I'm having a hard time googling it. Seems like maybe Grav's tab approach is the way to go, but again, i don't want to have create a bunch of blank inputs, i'd prefer the user just hit "add" and get a new input to use.

Most helpful comment

User management is probably coming in Grav 1.7. We already 'snuck-in' Flex Users into 1.6 that will power user management capabilities (and much much more as we approach Grav 2.0)

Regarding your question, it's pretty simple in Grav to create a plugin with a custom action to store data from a form in whatever format you like. Then in that same custom plugin you add some logic to display the data in the admin.

if you store your form submissions as .json or .yaml in the data folder, you can already use the "Data Manager" plugin (which is a bit rough) to view the data. This is probably better suited to a discussion on Discord chat though.

All 6 comments

I figured it out. It's a "list." Works similar to KirbyCMS's structures.

title: Page Content
@extends: 
  type: default
  context: blueprints://pages 

form:
  fields:
    tabs:
      type: tabs
      active: 1

      fields:
        content:
          type: tab
          fields:
            header.months:
              name: months
              type: list
              style: vertical
              label: Months
              fields:
                .month:
                  type: text
                  label: Month
                .name:
                  type: text
                  label: Name
                .pdf_link:
                  type: pagemediaselect
                  label: Select a PDF

I think Kirby might of borrowed this functionality from Grav :)

Haha, that's amazing. Makes sense.

I left KirbyCMS about a month ago, and am slowly recreating all my recipes in Grav. So far so good. Definitely committing to Grav. User management in admin portal is hard to do without, but I'm writing work arounds.

The one thing I cannot get to work is writing content back into the page as hidden and then have it show up in the admin panel for a user. Simplest example, submit an email via a form, but then have all those emails viewable in the admin panel. Couldn't figure it out. After that, I'm set.

User management is probably coming in Grav 1.7. We already 'snuck-in' Flex Users into 1.6 that will power user management capabilities (and much much more as we approach Grav 2.0)

Regarding your question, it's pretty simple in Grav to create a plugin with a custom action to store data from a form in whatever format you like. Then in that same custom plugin you add some logic to display the data in the admin.

if you store your form submissions as .json or .yaml in the data folder, you can already use the "Data Manager" plugin (which is a bit rough) to view the data. This is probably better suited to a discussion on Discord chat though.

Oooooooh, that might be the ticket. Thanks!

Flex objects can also be used to create forms into the frontend and automatically have full admin functionality available without writing a line of code. You can even write your custom views into the frontend to display all the data in the way you want to without too much effort.

That said it's still pretty much work in progress with missing pieces that we need to either solve or release. But we are getting there!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gizmecano picture gizmecano  路  17Comments

marktaylor46 picture marktaylor46  路  26Comments

joville picture joville  路  23Comments

lazzich picture lazzich  路  19Comments

giansi picture giansi  路  17Comments