Files section without add button in Kirby 4

How do we setup a files section in Kirby 4 that doesn’t have an “add” button?

I already tried:

  • upload: false, but I think that only works for a files field
  • max: 0, but that keeps the add button at the top

In Kirby 3 I used the filesdisplay section plugin for that, but I see it has been archived now.
Maybe @texnixe can shine a light on this, as I used to use her plugin?

Thx!

Hm, what are you trying to achieve, apart from removing the button? So you have a list of uploaded images the user cannot add to? You could set the section to max: 1 instead of max: 0 (guess 0 is not a valid value here).

You are right, there is no upload option, only a computer upload method which I set to false in the Filesdisplay section plugin.

So other than setting max: 1 as a workaround, you would probably have to extend the section.

My use case is having a tab that lists all the files of that page. I usually disallow uploading files there directly, as I want editors to upload them in via the designated fields with the designated template.

It’s basically an overview of all files of the current page where they can e.g. remove them, or edit them.

Unfortunately setting max: 1 is confusing imho.

@texnixe , is there somewhere documentation how I get started with extending a core section? Thx!

Hi Bart,
I’m currently updating the only page I have with the filesdisplay section plugin and just found out that if take the last PR made in Github and copy it into the src/FilesDisplaySection.php the plugin works again in Kirby 4.

Maybe this will help you a little bit.

cheers
tom

1 Like

It might actually suffice to take the filesdisplay section php part as a basis and just replace set the upload function to false, leaving the rest alone.