{% sw_extends "@MoorlForms/plugin/moorl-fb/component/element/field.html.twig" %}
{% set sectionConfig = {
value: element.value,
mediaUrl: element.media.url,
mediaId: element.media.id
} %}
{% block input_el %}
{% if element.media %}
<input type="hidden" name="{{ elementTechnicalName }}" value='{{ sectionConfig|json_encode|raw }}'>
{% endif %}
<div class="custom-file">
<input type="file"
accept="{{ element.config.upload.accept|join(',') }}"
name="{{ elementTechnicalName }}"
placeholder="{{ element.translated.placeholder ?: element.translated.name }}"
{% if element.required %}required{% endif %}
class="custom-file-input"
id="{{ elementId }}">
<label class="custom-file-label" title="{{ "moorl-fb.browse"|trans }}"
for="{{ elementId }}">{{ element.translated.placeholder ?: element.translated.name }}</label>
</div>
{% endblock %}
{% block input_subline %}
{% if element.config.upload.mediaType == 'custom' %}
<small class="text-muted">{{ element.config.upload.accept|join(', ') }}</small>
{% elseif element.config.upload.mediaType != 'all' %}
<small class="text-muted">{{ "moorl-fb.mediaType.#{element.config.upload.mediaType}"|trans }}</small>
{% endif %}
{% endblock %}