{% block artgris_media_widget %} {% apply spaceless %} {% with {'form': form, 'collection': false, 'id': form.vars.id, 'conf': conf, 'extra': extra } only %} {{ block('render_media') }} {% endwith %} {% endapply %} {% include '@ArtgrisMedia/form/_modal.html.twig' %} {% include '@ArtgrisMedia/form/_crop_modal.html.twig' with {crop_options: form.vars.crop_options} %} {% endblock %} {% block artgris_media_collection_widget %} {% apply spaceless %} {% if prototype is defined %} {% set data_prototype %} {% with {'form': prototype, 'collection': true, 'id': form.vars.id, 'conf': conf, 'extra': extra } only %} {{ block('render_media') }} {% endwith %} {% endset %} {% set attr = attr|merge({'data-prototype': data_prototype}) %} {% set attr = attr|merge({'data-prototype-name': prototype.vars.name}) %} {% endif %} {% set attr = attr|merge({'data-allow-add': allow_add ? 1 : 0}) %} {% set attr = attr|merge({'data-max': data_max ? data_max : 100}) %} {% set attr = attr|merge({'data-min': data_min ? data_min : 0}) %} {% set attr = attr|merge({'data-init-with-n-elements': data_init_with_n_elements ? data_init_with_n_elements : 1}) %} {% set attr = attr|merge({'data-add-at-the-end': data_add_at_the_end ? data_add_at_the_end : false}) %} {% set attr = attr|merge({'data-allow-remove': allow_delete ? 1 : 0 }) %} {% set attr = attr|merge({'data-name-prefix': full_name}) %}
{% for media in form %} {% with {'form': media, 'collection': true, 'id': form.vars.id, 'conf': conf, 'extra': extra } only %} {{ block('render_media') }} {% endwith %} {% endfor %}
{% include '@ArtgrisMedia/form/_modal.html.twig' %} {% set crop_options = prototype is defined ? prototype.vars.crop_options : (form.children|first).vars.crop_options|default %} {% if crop_options %} {% include '@ArtgrisMedia/form/_crop_modal.html.twig' with {crop_options: crop_options} %} {% endif %} {% endapply %} {% endblock %} {# {% with {'form': form, 'collection': true, 'id': form.vars.id, 'conf': conf } only %} {{ block('render_media') }} {% endwith %} #} {% block render_media %} {% apply spaceless %}
{% if collection %}
{% endif %} {% set base_path = form.vars.allow_crop ? get_web_path(conf, extra) : 1 %} {% block file_preview %}
{% set preview = fileIcon(form.vars.data).html %} {% if form.vars.allow_crop and ' {{ preview|raw }} {% else %} {{ preview|raw }} {% endif %}
{% endblock %} {# label + input #}
{% block fields %} {% endblock %}
{% if collection %}
{% block media_buttons_collection %} {% include '@ArtgrisMedia/form/_btn_manager.html.twig' with {'id' : id, 'form' : form, 'conf': conf, 'extra': extra} only %} {% endblock %}
{% else %}
{% block media_buttons %} {% include '@ArtgrisMedia/form/_btn_manager.html.twig' with {'id' : id, 'form' : form, 'conf': conf, 'extra': extra, 'collection': false} only %} {% endblock %}
{% endif %} {% if collection %} {% endif %}
{% if collection and form.vars.errors|length > 0 %}
{{ form_errors(form) }}
{% endif %}
{% endapply %} {% endblock %}