{% extends 'areas/row/editables.html.twig' %}
{% block view %}
{% set timestamp = 'now'|date('u') %}
{% if rowBackground == "image" %}
{% set markers = rowImage.getMarker() %}
{% set markerX = '' %}
{% set markerY = '' %}
{% set break = false %}
{% for marker in markers %}
{% if not break %}
{% if marker.data == [] and marker.name == '' %}
{% set markerX = marker.left %}
{% set markerY = marker.top %}
{% set break = true %}
{% endif %}
{% endif %}
{% endfor %}
{% if markerX > 0 and markerY > 0 %}
{% set imagePosition = image_marker_position_x_y(markerX, markerY) %}
{% else %}
{% set imagePosition = 'center-center' %}
{% endif %}
{% endif %}
{% if rowWidth == 'full-width' %}
{% set containerWidth = '-fluid' %}
{% else %}
{% set containerWidth = '' %}
{% endif %}
{# {% if rowBorder == 'border' %}
{% set borderValue = 'border' %}
{% else %}
{% set borderValue = '' %}
{% endif %} #}
{# {% if contentInclude is not defined %}
{% set rowBorderSelectValue = rowBorderSelect.isChecked() %}
{% endif %} #}
{% if contentInclude is not defined %}
{% set rowGutterSelectValue = rowGutterSelect.isChecked() %}
{% endif %}
{% if rowContainerWidth is not defined %}
{% set rowContainerWidth = 'spacing-component-container-width-none' %}
{% endif %}
{% if rowBorderSelect is not defined %}
{% set rowBorderSelect = false %}
{% endif %}
{% if wysiwygBackground is not defined %}
{% set wysiwygBackground = 'none' %}
{% endif %}
{% if rowPaddingLeftRight == null or rowEffects == 'sticky' %}
{% set rowPaddingLeftRightClass = '' %}
{% else %}
{% set rowPaddingLeftRightClass = rowPaddingLeftRight %}
{% endif %}
{% if rowPaddingTopBottom == null or rowEffects == 'sticky' %}
{% set rowPaddingTopBottomClass = '' %}
{% else %}
{% set rowPaddingTopBottomClass = rowPaddingTopBottom %}
{% endif %}
{# Set rowPaddingClass. For example 'spacing-padding-top spacing-padding-bottom' #}
{# {% if rowPadding == null or rowPadding == 'spacing-padding-none' or rowBackground == "video" or rowStickyValue == true %} #}
{# {% set rowPaddingClass = '' %} #}
{# {% else %} #}
{# {% set rowPaddingClass = rowPadding ~ '-top ' ~ rowPadding ~ '-bottom' %} #}
{# {% set rowPaddingClass = rowPadding %} #}
{# {% endif %} #}
<section class="c-row js-anchor-target {{rowMargin}} {% if rowContainerWidth == 'spacing-component-container-width-none' %} {{rowPaddingLeftRightClass}} {{rowPaddingTopBottomClass}} background-{{rowBackground}} {% endif %}
{# Fix height if not sticky #}
{% if rowEffects != 'sticky' %}c-row__height--{{rowHeight}}{% endif %}
{% if (rowBackground == 'video' or rowBackground == 'image') and rowGradient != 'none' and not editmode %}gradient-color-{{rowShade}}{% endif %}
{# Parallax #}
{% if rowEffects == 'parallax' %}c-row__parallax{% endif %}
"
{# Background image if not sticky and background position if not parallax #}
{% if rowContainerWidth == 'spacing-component-container-width-none' %}
{% if rowBackground == "image" and rowEffects != 'sticky' %}
style="background-image: url({{ rowImage.thumbnail('content-full') }});background-repeat: no-repeat; background-size: cover;{% if rowEffects != 'parallax' %} background-position: {{imagePosition|replace({'-' : ' '})}}{% endif %}"
{% endif %}
{% endif %}
data-area-name="{{rowAnchor}}" data-target="{{timestamp}}" {% if editmode %}id="{{timestamp}}"{% endif %}
>
{# gradient #}
{% set gradient %}
{% if (rowBackground == 'video' or rowBackground == 'image') and rowGradient != 'none' %}
{% if rowGradientOpacity.number %}
{% set opacity = rowGradientOpacity.number / 100 %}
{% endif %}
{% if rowShade is not defined or rowShade is null %}
{% set rowShade = 'dark' %}
{% endif %}
<div class="gradient-{{rowGradient}} gradient-color-{{rowShade}}"{% if rowGradientOpacity.number %} style="--gradientOpacity: {{opacity}}; --gradientSize: {% if editmode %}100{% else %}{{rowGradientSize}}{% endif %}%"{% endif %}></div>
{% endif %}
{% endset %}
{% if rowBackground == "image" and rowEffects != 'sticky' %}
{{gradient}}
{% endif %}
{# video background #}
{% if rowBackground == "video" %} {# and not editmode #}
<div class="c-row__video{% if rowEffects == 'sticky' %} c-row__sticky{% endif %}">
{% if editmode %}
{# {{ dump(rowVideo.getPosterAsset()) }} #}
{% else %}
{{ rowVideo | raw }}
{{gradient}}
{% endif %}
</div>
{% endif %}
{# Sticky image background #}
{% if rowBackground == "image" and rowEffects == 'sticky' %} {# and not editmode #}
<div class="c-row__sticky">
<div class="c-row__image" style="background-image: url({{ rowImage.thumbnail('content-full') }}); background-position: {{imagePosition|replace({'-' : ' '})}}; background-repeat: no-repeat; background-size: cover;"></div>
{{gradient}}
</div>
{% endif %}
<div class="container{{containerWidth}} {% if rowWidth == 'full-width' %}p-0{% endif %} {% if rowGutterSelectValue == false and rowWidth == 'full-width' %}overflow-hidden{% endif %}">
<div class="row justify-content-{{rowJustify}} {% if rowGutterSelectValue == true %}g-0{% endif %} {% if rowBorderSelect == true %}border-color-primary-light{% endif %} {% if rowContainerWidth == 'spacing-component-container-width' %} {{rowPaddingLeftRightClass}} {{rowPaddingTopBottomClass}} background-{{rowBackground}} m-0 {% endif %}"
{# background image same size as container #}
{% if rowBackground == "image" and rowEffects != 'sticky' %}
style="background-image: url({{ rowImage.thumbnail('content-full') }});background-repeat: no-repeat; background-size: cover;{% if rowEffects != 'parallax' %} background-position: {{imagePosition|replace({'-' : ' '})}}{% endif %}"
{% endif %}
>
{% if contentInclude is not defined %}
{% set cols = pimcore_block('gridblock', {
reload: true,
class: 'editmode__pimcore-block-button'
}) %}
{% set colStickyVisible = true %}
{% if rowGutterSelectValue == false and rowWidth == 'full-width' %}
{% set colStickyVisible = false %}
{% endif %}
{% for col in cols.iterator %}
{% if editmode %}
<div class="editmode-col col {% if rowShade == 'bright' %}gradient-text-color-bright{% endif %}" style="border: 2px dashed rgba(0,0,0, 0.3);">
{# {% include "areas/col/view.html.twig" with {'rowBackground': rowBackground} %} #}
{% include "areas/col/view.html.twig" with {'rowJustify': rowJustify, 'colStickyVisible': colStickyVisible} %}
</div>
{% else %}
{% include "areas/col/view.html.twig" with {'rowJustify': rowJustify, 'colStickyVisible': colStickyVisible} %}
{% endif %}
{% endfor %}
{% else %}
{% for col in cols %}
{% include 'areas/col/view.html.twig' with col %}
{% endfor %}
{% endif %}
</div>
</div>
</section>
{% if editmode %}
{# Sets col width according to selection, only for backend view #}
<script>
(function() {
const rows = document.querySelectorAll('.c-row');
const cols = document.querySelectorAll('.c-row .editmode-col');
rows.forEach((row) => {
let childRow = row.querySelector('.row');
let blockEntry = row.querySelectorAll('.pimcore_block_entry');
let block = row.querySelector('.pimcore_editable_block');
if (block && blockEntry?.length > 0) {
childRow.classList.forEach((htmlClass) => {
block.classList.add(htmlClass);
});
}
});
cols.forEach((col) => {
let childCol = col.querySelector('.c-col');
if (childCol && childCol.dataset.width) {
col.parentElement.classList.add('col-' + childCol.dataset.width);
} else if (childCol && !childCol.dataset.width) {
col.parentElement.classList.add('col');
}
});
})();
</script>
{% endif %}
{% endblock %}