How to manage different files section/field in a blueprint?

This files section/field-thingie keeps confusing me…

Consider following use case: in a blueprint I have

  • a “hero” files field - limited to 1 item, with the “heroimage”-file template (when uploading)
  • a “slider” files field - with the “sliderimage”-file template
  • a textarea field

Editors can thus upload images from 3 different fields. I assume this is not an uncommon scenario.

Now, how do you let editors manage (delete/replace) images uploaded from the textarea?

I know I can add a files section, but then this gets confusing, as the images from the other 2 fields are suddenly also appearing here. AFAIK I can’t filter those images here (that only works on a files field with the query option)?
My current “solution” is that I added a “contentfile”-template to the textarea uploads that I can recognize in the files section and use that template to only display those. But it feels wonky…

Why do the files in this setup need different templates?

How about a files section in a separate tab that serves as page specific media repo from which you can download/upload/replace files, that are then selected in the content tab. So the section is sort of “out of the way” but accessible if needed.

E.g. the heroimage needs a certain aspect ratio. Listing all other files in that field of the “page media repo” sets wrong expectations for the editors, and is confusing.

If you assign textarea uploads another template, you can use a files section to only display those via template option (no query needed).

Something like:

textarea:
  type: textarea
  files:
    query: page.files.template("textarea-upload")
  uploads:
    template: textarea-upload
filessection:
  type: files
  template: textarea-upload

Ups, didn’t see your last sentence… you already do this :sweat_smile:

1 Like

@REH, you’re correct. That’s what I do now with “contentfile” template. And this works.

I just wondered if there wasn’t a better way…

I kinda miss the “marriage” of the files section and the files field. If the files section would have “sort” and “query” in it, I think I wouldn’t need the files field any longer? But maybe I’m not seeing something?


Edit: nevermind the above. Files sections allow files to be uploaded but remain unselected. That was the main differentiator. I forgot. Sorry!

The thing is, that to sort files in a files section, you would need some logic that only sorts the files within this section. But what if that files was also part of another files section?

A files field is just a select field, on the other hand. It stores the filenames in the content file.

1 Like

You’re right @texnixe. Ofcourse. I oversighted this… Sorry!