Kirby 3.6 adding files field to plugin page

Hi,

i have try to extend the advanced panel area sample (Advanced Panel area | Kirby CMS) with an image field. In the dialogs folder is an fields.php file. When i click “add product” on the plugin page, a popup open and i see a files area. If i try to select or upload a file, i’ll get an error: Cannot read properties of undefined (reading ‘field’)

Is this a bug?

return [
    'title' => [
        'label' => 'Title',
        'type'  => 'text'
    ],
    'image' => [
        'label' => 'Title',
        'type'  => 'files'
    ],

Did you find out?

I was looking to achieve the same and stumbled on the same error: Cannot read properties of undefined (reading ‘field’).

Maybe @texnixe or @distantnative could help us to find out where the field properties have to be defined. I imagine, for virutal page, we need do define what happen when:

  • where the files are stored (for virtual pages…)
  • when upload is called
  • when upload is created
  • where to look for the other files
  • and so on…

not a final solution but… so far… after some research… I would forget the default type files and go with

  1. a custom panel field ( [My first Panel field | Kirby CMS (getkirby.com)]
    (My first Panel field | Kirby CMS)
  2. get inspiration from How to upload an Image while creating a Page in a Section Plugin - Plugins / Kirby 3 plugin :jigsaw: - Kirby (getkirby.com) (thank you @dennisb…)
  3. more info with Uploads | Kirby CMS (getkirby.com) and maybe define a custom route for upload…

Hope it helps others :slight_smile:

1 Like