Files field, more than one file template

A client would like to have both images and short video files in a files field with cards layout, so she can order both around to her liking, and then I can output them in that order on the frontend.

That is certainly possible but what seems not possible is to assign different file templates to images and video, here, as they are uploaded using the same files field.

Or is it ?

Any not-too-crazy workaround ?

Thank you

Exactly, for upload you can only assign a single template. The only workaround would be to prevent uploading via the field and add different files sections with different templates for uploading.

Possible workaround: assign different template after upload in file view.

Thank you!

I see now two potential additional workarounds:

  1. Having an image & video template which includes fields for both types
  2. Assign template on a hook, after upload, depending on mime or extension (untested)

Yes, if this is about different content fields based on mime type, Iā€™d go for this option.

1 Like