Structure block type

Hello,

I want to create a structure block type.

My block blueprint so far:

structure:
  name: Structure
  type: structure
  columns:
    record:
      type: text
    period:
      type: text
  fields:
    record:
      type: text
    period:
      type: text

My page blueprint:

fields:
  blocks:
    type: blocks
    fieldsets:
      - structure

When editing, I get the message:

Missing field setup

What’s wrong?

The blueprint structure must be the same as in the original ones:

name: Structure
icon: whatever # optional
columns:
  record:
    type: text
  period:
    type: text
fields:
  record:
    type: text
  period:
    type: text
1 Like

Thank you.

The columns don‘t show up. If I add preview: text, it shows only the field named text. Is there a way to show all filled block content in the panel—fields text and period?

name: Structure
preview: text
fields:
  text:
    type: text
  period:
    type: text

You can create preview for your custom blocks as described here:

Nonetheless I’m startled there isn’t such a thing already …

There is an undocumented table field that needs to have a structure field setup (it doesn’t have inline editing, though). I wonder how difficult it would be to turn this into a inline editing preview (but the problem will be the types of fields you use inside your structure).

Example setup:

        fields:
          blocks:
            type: blocks
            fieldsets:
              table:
                extends: blocks/table
                fields:
                  rows:
                    type: structure
                    columns:
                      title:
                          width: 1/4
                      description:
                          width: 1/2
                      price:
                          width: 1/4
                          align: right
                          after: "USD"
                    fields:
                      title:
                          type: text
                      description:
                          type: textarea
                      price:
                          type: number