<div class="multi-download-pp content">
{% if resource.files is not empty %}
{% if resource.header is defined and resource.header is not empty %}<h2 class="simple">{{ resource.header }}</h2>{% endif %}
{% set url = path('gcs_api_multidownload_item') ~ '?' %}
<ul class="filelist">
{% for file in resource.files | sortbyfield('displayOrder') %}
{% set fileType = file.media.contentType|split('/')[0] %}
{% if fileType == "image" %}
{% set className = 'file-type--image' %}
{% elseif fileType == "video" %}
{% set className = 'file-type--media' %}
{% else %}
{% set className = 'file-type--doc' %}
{% endif %}
<li class="filelistItem">
<a href="{{ file.media.url }}" class="fileTitle">{{ file.media.name ? file.media.name : file.media.originalFilename }}</a>
<span class="fileSize">{{ file.media.filesize }}</span>
<a href="{{ file.media.url }}" class="fileDownload">{{ 'multi-download-pp.download-href.label'|trans }}</a>
<a href="{{ file.media.url }}" class="fileDownload"><i class="fileIcoMime {{ className }}"></i></a>
</li>
{% set url = url ~ 'files[]=' ~ file.id %}
{% if not loop.last %}
{% set url = url ~ '&' %}
{% endif %}
{% endfor %}
</ul>
<a href="{{ url }}" class="btn btn--blue downloadAllFiles">{{ 'multi-download-pp.download-btn.label'|trans }}</a>
{% endif %}
</div>