{# Image Cover =========== #} {# -- Macros -- #} {% import '_macros/_macro-image.html' as macroImage %} {# -- Set Vars -- #} {% set classname = name is defined and name is not empty ? name : 'm-imageSingle' %} {% set image = data.singleImage.first() is defined ? data.singleImage.first() %} {% set settings = data.settingsImageSingle is defined ? data.settingsImageSingle %} {% set caption = image.groupedCaption is defined ? image.groupedCaption %} {% if caption and settings.caption %} {% set captionTitle = caption.captionTitle is defined ? caption.captionTitle : '' %} {% set captionCaption = caption.caption is defined ? caption.caption : '' %} {% set captionSource = caption.source is defined ? caption.source : '' %} {% set captionSourceUrl = caption.sourceUrl is defined ? caption.sourceUrl : '' %} {% else %} {% set captionTitle = '' %} {% set captionCaption = '' %} {% set captionSource = '' %} {% set captionSourceUrl = '' %} {% endif %} {% set imagePosition = settings.imagePosition is defined ? ' ' ~ classname ~ '--image-' ~ settings.imagePosition %} {% set imageWidth = settings.imageWidth is defined ? ' ' ~ classname ~ '--image-' ~ settings.imageWidth : ' ' ~ classname ~ '--image-full' %} {% if settings.imageRatio is defined %} {% switch settings.imageRatio %} {% case "landscape" %} {% set ratio = '16:10' %} {% case "square" %} {% set ratio = '1:1' %} {% case "portrait" %} {% set ratio = '10:16' %} {% endswitch %} {% else %} {% set ratio = '' %} {% endif %} {# -- Modul -- #}
{% set options = { ratio: ratio } %} {{ macroImage.image(image, options) }} {% if (caption and captionTitle is not empty) or (caption and captionCaption is not empty) %}
{% if captionTitle %} {{ captionTitle|raw }}{{ captionCaption and captionTitle ? ': ' }} {% endif %} {{ captionCaption|raw }} {% if captionSourceUrl %} — {% endif %} {{ captionSource }} {% if captionSourceUrl %} {% endif %}
{% endif %}