{% from '@Provider/macros/media.html.twig' import media as conecto_media %}
{% from '@Provider/macros/media_edit.html.twig' import media_edit as conecto_media_edit %}
{% from '@Provider/macros/include-svg.html.twig' import includeSvg %}
{# Default block settings #}
{% set class = pimcore_input('class').getData() %}
{% set marginTop = pimcore_select('margin_top').getData() %}
{% set marginBottom = pimcore_select('margin_bottom').getData() %}
{% set containerWidth = pimcore_select('container_width').getData() %}
{% set areaClass = class ~ ' ' ~ marginTop ~ ' ' ~ marginBottom ~ ' ' ~ containerWidth %}
{% set anchorId = pimcore_input('anchor').getData() %}
{# Block specific settings #}
{% set htag = pimcore_select('tag').getData() %}
{% set special = pimcore_checkbox('special').isChecked() ? true : false %}
{% set mediaWidth = pimcore_select('media_width').getData() ? pimcore_select('media_width').getData() : 50 %}
{% set textWidth = pimcore_select('media_width').getData() ? (100 - pimcore_select('media_width').getData()) : 50 %}
{% set colRatio = textWidth ~ '-' ~ mediaWidth %}
{% set imageRatio = pimcore_select('ratio').getData() ? pimcore_select('ratio').getData() : 3/2 %}
{% set showLightbox = 0 %}
{% set showCopyright = pimcore_checkbox('copyright').isChecked() %}
{% set showCaption = pimcore_checkbox('caption').isChecked() %}
{# Special video settings #}
{% set videoAddAttributes = {} %}
{% set videoRemoveAttributes = pimcore_checkbox('controls').isChecked() ? [] : ['controls'] %}
{% if pimcore_checkbox('autoplay').isChecked() %}{% set videoAddAttributes = videoAddAttributes|merge({autoplay: '', playsinline: ''}) %}{% endif %}
{% if pimcore_checkbox('loop').isChecked() %}{% set videoAddAttributes = videoAddAttributes|merge({loop: ''}) %}{% endif %}
{% if pimcore_checkbox('mute').isChecked() %}{% set videoAddAttributes = videoAddAttributes|merge({muted: ''}) %}{% endif %}
<div class="area area--promo-content {{ areaClass }}"{% if anchorId %} id="{{ anchorId }}"{% endif %}>
{% if not pimcore_link('link').isEmpty() %}
<a href="{{ pimcore_link('link').getHref() }}" {% if pimcore_link('link').getTarget() %}target="{{ pimcore_link('link').getTarget() }}"{% endif %}>
{% endif %}
<div class="area--promo-content-inner">
{% if editmode %}
{{ conecto_media_edit(
'promocontent_',
(1920 * mediaWidth / 100),
(1920 * mediaWidth / 100) / imageRatio
) }}
{% else %}
{% if not pimcore_image('promocontent_image').isEmpty() %}
{{ conecto_media(
pimcore_image('promocontent_image').getImage(),
editmode,
showLightbox,
showCopyright,
showCaption,
{
thumbName: 'promocontent',
ratio: imageRatio,
cols: 100 / mediaWidth,
widgetAltText: pimcore_image('promocontent_image').getAlt()
}
) }}
{% endif %}
{% if not pimcore_video('promocontent_video').isEmpty() %}
{{ pimcore_video('promocontent_video', {
"width": "100%",
"height": "100%",
"attributes": videoAddAttributes,
"removeAttributes": videoRemoveAttributes
}) }}
{% endif %}
{% endif %}
<div class="promo-content--container text-center">
<{{ htag }}{% if special %} class="special"{% endif %}>
{{ pimcore_input('promocontent_headline') }}
{% if special %}
<span class="spacer">{{ includeSvg('diverses/diamond') }}</span>
{% endif %}
<small>{{ pimcore_input('promocontent_subheadline') }}</small>
</{{ htag }}>
{% if editmode %}
{{ pimcore_link('link', { 'reload': true }) }}
{% endif %}
{% if not pimcore_link('link').isEmpty() %}
<button class="btn btn-{% if pimcore_link('link').getClass() %}{{ pimcore_link('link').getClass() }}{% else %}outline{% endif %}">
{{ pimcore_link('link').getText() }}
</button>
{% endif %}
</div>
</div>
{% if not pimcore_link('link').isEmpty() %}
</a>
{% endif %}
</div>