0

I have a field field_file. I've created a template field--field_file.html.twig.

How can I access the link, description (and attributes and icon ) separately in this file?

I have:

{% for item in items %}
  {{ item.content }}
{% endfor %}

which just spits out themed content.

I've debugged with dump() and there seems like the possibility of at least retrieving the 'description' somehow, but item.description does not work, for example.

1 Answer 1

2

File link: {{ file_url(item.content['#file'].getFileUri()) }}

File description: {{ item.content['#description'] }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.