Files section in image blueprint Error V5

Hello everyone,

after updating from version 4 to 5.2.2, I get the following error message:

Der Bereich “spread_image_section” konnte nicht geladen werden:
Kirby\Panel\Collector\FilesCollector::__construct(): Argument #4 ($parent) must be of type Kirby\Cms\Site|Kirby\Cms\Page|Kirby\Cms\User|null, Kirby\Cms\File given, called in /Users/[…]/kirby/config/sections/files.php on line 68

It relates to a files section in the image blueprint.

image.yml

Title: Image

accept: image/*
focus: false

columns: 
  left_column:
    width: 1/3
    sections:
      spread_image_section:
        type: files
        label: 
          en: "Spread"
          de: "Druckbogen"
        layout: cards
        size: large
        limit: 1
        link: false
        query: file.parent.images.filterBy("template", "spread").filterBy("spread_number_field", file.document_spread_field)
        image: 
          cover: false
      spread_data_section:
        type: fields
        fields:
          document_spread_field:
            label:
              en: "Document Spread"
              de: "Druckbogen"
            type: number
            width: 1/2
  right_column:
    width: 2/3
    sections:
      ...

Can anyone tell me what has changed here? Is this no longer possible in v5?

Thanks!

Hm, good question, but I wasn’t aware that having a files section in a files blueprint was possible at all

Until now, it worked. :grinning_face:

This is probably a very specific use case. I have now chosen a different approach, using a field plugin.

While doing so, I noticed that the approach of passing a string for the template apparently no longer works: Fields | Kirby CMS

panel.plugin("your/plugin", {
  fields: {
    hello: {
      props: {
        message: String
      },
      template: "<p>{{ message }}</p>"
    }
  }
});

This is what appears in the HTML code:

However, it works with the render function.

How is message defined a) in your index.php b) in your blueprint that uses the field?

When I use the example from the documentation, I get the result shown in the screenshot. Fields | Kirby CMS Kirby version 5.2.2.

<?php

Kirby::plugin('your/plugin', [
    'fields' => [
        'hello' => [
            'props' => [
                'message' => function (string $message) {
                    return $message;
                }
            ]
        ]
    ]
]);

In the file blueprint

fields:
  hello:
    type: hello
    message: This is my very first field

When I use render(h) instead template: `…`, it works.

I tested the same example from the docs in a 5.2.1 Starterkit, and cannot reproduce your result:

Hmm, strange. I’ll try going back to 5.2.1. Otherwise, it must be due to a specific configuration on my end.

Thanks for testing!

Shouldn’t be a problem with Kirby 5.2.1 vs. 5.2.2., updated to 5.2.2 without issues.