Files field info/text property conditionals?

Hi, is there support for conditionals for files field info/text properties?

fields:
      gallery:
        type: files
        query: page.images
        layout: list
        info: "{{ file.dimensions }}"
        text: "{{ file.alt }}"

What exactly do you want to achieve?

For example, I would like to display Alt text, but if empty to display something else, the file name maybe.

You should be able to use or():

info: "{{ file.alt.or(file.filename) }}"

If that doesn’t work, you can use a custom file method instead.

2 Likes

Works :sunglasses:

Thank you very much, you rock :muscle:

1 Like

Just a note, it works with files field, but not with files preset.