All fields suddenly deleted after saving (using nested Layout)

I have a very annoying problem:

I use multiple layouts on a page:

title: Selektion Article

fields:
  coverimage:
    type: files
    min: 1
    max: 1
  articlesections:
    label: Sections
    type: structure
    fields:
      sectionimage:
        type: files
        min: 1
        max: 1
      layout:
        type: layout
        layouts:
          - "1/1"
          - "1/2, 1/2"
        fieldsets:
          - headline
          - text
          - image
          - button
          - slider
          - imagegallery

everytime after creating a text field and saving, all other layout fields are completely gone.

No idea what causes this weird behaviour.

Which Kirby 5 version are you using?

With a quick test in a 5.1.4 Starterkit and your blueprint, I couldn’t reproduce the issue.

Please post exact steps to reproduce your issue in a fresh Starterkit.

Oh, and please also post the yaml for the custom blocks (headline, button, slider, imagegallery)

it’s 5.1.3

name: Button
icon: bolt
preview: fields
wysiwyg: true
tabs:
  content:
    fields:
      link:
        type: link
      text:
        type: text
  styles:
    fields:
      class:
        type: text
      id:
        type: text
name: headline
icon: headline
preview: fields
wysiwyg: true
fields:
  text:
    type: text
name: Gallery
icon: images
preview: fields
wysiwyg: true

fields:
  galleryimages:
    label: Images
    type: files
    min: 1

name: field.blocks.text.name
icon: text
wysiwyg: true
preview: text
fields:
  text:
    type: textarea
    nodes: false
    placeholder: field.blocks.text.placeholder
  alignment:
    label: Alignment
    type: radio
    options:
      - left
      - right
      - center
name: Slider
icon: images
preview: fields
wysiwyg: true

fields:
  sliderimages:
    label: Images
    type: files
    min: 1

problem is still occurring in 5.1.4 (PHP 8.4.13, nginx/1.25.4)

Thanks so far, but again, what do I have to do to reproduce the issue, when exactly does it happen that all is suddenly gone?

  • i create a text field

  • i close the layout drawer

  • i hit save

  • all layout files are gone

    it only seems to happen when a text field has a line break

I cannot reproduce this.

Please download a fresh Starterkit, add your custom blocks and check if it happens there for you as well.

with the fresh starterkit everything works fine

Are you using any plugins that might interfere? Any other custom code?

no plugins so far, i also tried to delete the assets and all content files - still the same behaviour as soon as i have a break inside the text field

Is this text you have manually typed into the field or copy and pasted from another app like Word etc? I am wondering if there is a bad invisible carachter in there.

good thought but it only appears when i type it manually.

i now did a workaround and used a layout→blocks approach instead of layouts inside a structure field.

That’s probably a better idea. I personally don’t think having complex structures like a layout field inside a structure field is such a good idea, and will most likely end up with performance issues with many entries.

Are you using pretty: true by any chance?