Unable to nest layout fields, error 500 in the panel

Hi,
after many trials I cannot figure out why I am unable to define a layout field inside a custom block : when I set it up, the panel return a 500 & “The JSON response could not be parsed” in the editor view of the pages.
I suppose it’s possible since other topics mention a similar situation (like here : Cascade Layout-Fields).

here’s the page yml (blueprints/pages/default.yml) :

...
fields:
  content:
    label: Texte
    type: layout
    fieldsets:
      - text
      - grid
    layouts:
      - "1/1"
      - "1/2, 1/2"

an the grid block yml (blueprints/blocks/grid.yml) :

fields:
  grid:
    type: layout
    layouts:
      - "1/1"
      - "1/2, 1/2"
      - "1/3, 1/3, 1/3"

The nested block works just fine when the fieldsets list contain only defaults or custom blocks without blocks or layout fields inside.
I’m using kirby 3.6.0.

I would greatly appreciate some help on this one, thank you in advance :slight_smile:

Your grid.yml blueprint doesn’t seem to be complete (missing name, but maybe you didn’t post everything). Works find for me with

        fields:
          content:
            label: Texte
            type: layout
            fieldsets:
              - text
              - grid
            layouts:
              - "1/1"
              - "1/2, 1/2"

and /site/blueprints/blocks/grid.yml:

name: Grid
icon: grid
fields:
  text:
    type: layout
    layouts:
      - "1/1"
      - "1/2, 1/2"

Hum, I just copy-pasted what you posted, no change in the response.
I also tried updating to kirby 3.6.1 & downgrading to 3.5.8 and the same error occurs, since it works on your side I suppose it probably comes from my server config but I don’t know what could cause that :sweat_smile: is there a way to have a more detailed error / debug mode for the panel so I can dig a little deeper ?

Update :

  • after enablin error display in my php.ini fila it shows me this error : **Fatal error** : Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) (for different files each time I load the page)

  • I then tried to remove the ‘blocks’ fieldsets definition in my config file and finally, it works fine without it ! here’s what it looked like :

'blocks' => [
    'fieldsets' => [
        'text' => [
        'label' => 'Text',
        'type' => 'group',
        'fieldsets' => [
            'text',
            'heading',
            'list',
            'cta',
            'button',
            'grid'
            ]
        ],
        'media' => [
        'label' => 'Media',
        'type' => 'group',
        'fieldsets' => [
            'image',
            'video',
            'gallery'
            ]
        ],
        'code' => [
        'label' => 'Code',
        'type' => 'group',
        'fieldsets' => [
            'code',
            'markdown'
          ]
        ]
     ]
  ],

Did I do something wrong ? having it in one place was pretty useful, would love to be able to keep it :thinking:

I guess it’s some kind of infinite recursion. "grid" loads the config that also contains "grid", that then loads the config, that then loads "grid" again, and this continues until php runs out of memory…

You probably have to set a fieldset in grid.yml that explicitly doesn’t use “grid”.

I just tried to define a custom fieldset for grid.yml while keeping the config and it worked like a charm, thank you !!

1 Like