{% import 'common/thumbnail.html.twig' as thumbnail %} {% if not_wrapped is defined and not_wrapped %} {% set wrap = false %} {% else %} {% set wrap = true %} {% endif %} {% if autoplay is defined and autoplay %} {% set autoplay = true %} {% else %} {% set autoplay = false %} {% endif %} {% set previewHtml5 = null %} {# first check if type audio and there is no preview , fallback to thumbnail #} {% if app.getAclForUser(app.getAuthenticatedUser()).has_access_to_subdef(record, 'preview') and record.getType == 'audio' and record.has_preview == false %} {% set preview_obj = record.get_thumbnail() %} {% elseif app.getAclForUser(app.getAuthenticatedUser()).has_access_to_subdef(record, 'preview') %} {% set preview_obj = record.get_preview() %} {% else %} {% set preview_obj = record.get_thumbnail() %} {% endif %} {% set width = preview_obj.get_width() %} {% set height = preview_obj.get_height() %} {{ thumbnail.format(preview_obj, preview_obj.get_width(), preview_obj.get_height(), '', wrap, false, autoplay) }}