templates/areas/row/view.html.twig line 1

Open in your IDE?
  1. {% extends 'areas/row/editables.html.twig' %}
  2. {% block view %}
  3.   {% set timestamp = 'now'|date('u') %}
  4.   {% if rowBackground == "image" %}
  5.     {% set markers = rowImage.getMarker() %}
  6.     {% set markerX = '' %}
  7.     {% set markerY = '' %}
  8.     {% set break = false %}
  9.     {% for marker in markers %}
  10.       {% if not break %}
  11.         {% if marker.data == [] and marker.name == '' %}
  12.           {% set markerX = marker.left %}
  13.           {% set markerY = marker.top %}
  14.           {% set break = true %}
  15.         {% endif %}
  16.       {% endif %}
  17.     {% endfor %}
  18.     {% if markerX > 0 and markerY > 0 %}
  19.       {% set imagePosition = image_marker_position_x_y(markerX, markerY) %}
  20.     {% else %}
  21.       {% set imagePosition = 'center-center' %}
  22.     {% endif %}
  23.   {% endif %}
  24.   {% if rowWidth == 'full-width' %}
  25.     {% set containerWidth = '-fluid' %}
  26.   {% else %}
  27.     {% set containerWidth = '' %}
  28.   {% endif %}
  29.   {# {% if rowBorder == 'border' %}
  30.     {% set borderValue = 'border' %}
  31.   {% else %}
  32.     {% set borderValue = '' %}
  33.   {% endif %} #}
  34.   {# {% if contentInclude is not defined %}
  35.     {% set rowBorderSelectValue = rowBorderSelect.isChecked() %}
  36.   {% endif %} #}
  37.   {% if contentInclude is not defined %}
  38.     {% set rowGutterSelectValue = rowGutterSelect.isChecked() %}
  39.   {% endif %}
  40.   {% if rowContainerWidth is not defined %}
  41.     {% set rowContainerWidth = 'spacing-component-container-width-none' %}
  42.   {% endif %}
  43.   {% if rowBorderSelect is not defined %}
  44.     {% set rowBorderSelect = false %}
  45.   {% endif %}
  46.   {% if wysiwygBackground is not defined %}
  47.     {% set wysiwygBackground = 'none' %}
  48.   {% endif %}
  49.   {% if rowPaddingLeftRight == null or rowEffects == 'sticky' %}
  50.     {% set rowPaddingLeftRightClass = '' %}
  51.   {% else %}
  52.     {% set rowPaddingLeftRightClass = rowPaddingLeftRight %}
  53.   {% endif %}
  54.   {% if rowPaddingTopBottom == null or rowEffects == 'sticky' %}
  55.     {% set rowPaddingTopBottomClass = '' %}
  56.   {% else %}
  57.     {% set rowPaddingTopBottomClass = rowPaddingTopBottom %}
  58.   {% endif %}
  59.   {# Set rowPaddingClass. For example 'spacing-padding-top spacing-padding-bottom' #}
  60.   {# {% if rowPadding == null or rowPadding == 'spacing-padding-none' or rowBackground == "video" or rowStickyValue == true %} #}
  61.     {# {% set rowPaddingClass = '' %} #}
  62.   {# {% else %} #}
  63.     {# {% set rowPaddingClass = rowPadding ~ '-top ' ~ rowPadding ~ '-bottom' %} #}
  64.     {# {% set rowPaddingClass = rowPadding %} #}
  65.   {# {% endif %} #}
  66.   <section class="c-row js-anchor-target {{rowMargin}} {% if rowContainerWidth == 'spacing-component-container-width-none' %}  {{rowPaddingLeftRightClass}} {{rowPaddingTopBottomClass}}  background-{{rowBackground}} {% endif %}
  67.     {# Fix height if not sticky #}
  68.     {% if rowEffects != 'sticky' %}c-row__height--{{rowHeight}}{% endif %}
  69.     {% if (rowBackground == 'video' or rowBackground == 'image') and rowGradient != 'none' and not editmode %}gradient-color-{{rowShade}}{% endif %}
  70.     {# Parallax #}
  71.     {% if rowEffects == 'parallax' %}c-row__parallax{% endif %}
  72.    "
  73.     {# Background image if not sticky and background position if not parallax #}
  74.     {% if rowContainerWidth == 'spacing-component-container-width-none' %}
  75.     {% if rowBackground == "image" and rowEffects != 'sticky' %}
  76.       style="background-image: url({{ rowImage.thumbnail('content-full') }});background-repeat: no-repeat; background-size: cover;{% if rowEffects != 'parallax' %} background-position: {{imagePosition|replace({'-' : ' '})}}{% endif %}"
  77.     {% endif %}
  78.     {% endif %}
  79.     data-area-name="{{rowAnchor}}" data-target="{{timestamp}}" {% if editmode %}id="{{timestamp}}"{% endif %}
  80.   >
  81.   {# gradient #}
  82.   {% set gradient %}
  83.     {% if (rowBackground == 'video' or rowBackground == 'image') and rowGradient != 'none' %}
  84.       {% if rowGradientOpacity.number %}
  85.         {% set opacity = rowGradientOpacity.number / 100 %}
  86.       {% endif %}
  87.       {% if rowShade is not defined or rowShade is null %}
  88.         {% set rowShade = 'dark' %}
  89.       {% endif %}
  90.       <div class="gradient-{{rowGradient}} gradient-color-{{rowShade}}"{% if rowGradientOpacity.number %} style="--gradientOpacity: {{opacity}}; --gradientSize: {% if editmode %}100{% else %}{{rowGradientSize}}{% endif %}%"{% endif %}></div>
  91.     {% endif %}
  92.   {% endset %}
  93.   {% if rowBackground == "image" and rowEffects != 'sticky' %}
  94.     {{gradient}}
  95.   {% endif %}
  96.     {# video background #}
  97.      {% if rowBackground == "video" %} {# and not editmode #}
  98.       <div class="c-row__video{% if rowEffects == 'sticky' %} c-row__sticky{% endif %}">
  99.         {% if editmode %}
  100.           {# {{ dump(rowVideo.getPosterAsset()) }} #}
  101.         {% else %}
  102.           {{ rowVideo | raw }}
  103.           {{gradient}}
  104.         {% endif %}
  105.       </div>
  106.     {% endif %}
  107.     {# Sticky image background #}
  108.     {% if rowBackground == "image" and rowEffects == 'sticky' %}  {# and not editmode #}
  109.       <div class="c-row__sticky">
  110.         <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>
  111.         {{gradient}}
  112.       </div>
  113.     {% endif %}
  114.     <div class="container{{containerWidth}} {% if rowWidth == 'full-width' %}p-0{% endif %} {% if rowGutterSelectValue == false and rowWidth == 'full-width' %}overflow-hidden{% endif %}">
  115.       <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 %}"
  116.       {# background image same size as container #}
  117.       {% if rowBackground == "image" and rowEffects != 'sticky' %}
  118.         style="background-image: url({{ rowImage.thumbnail('content-full') }});background-repeat: no-repeat; background-size: cover;{% if rowEffects != 'parallax' %} background-position: {{imagePosition|replace({'-' : ' '})}}{% endif %}"
  119.       {% endif %}
  120.       >
  121.         {% if contentInclude is not defined %}
  122.           {% set cols = pimcore_block('gridblock', {
  123.             reload: true,
  124.             class: 'editmode__pimcore-block-button'
  125.           }) %}
  126.           {% set colStickyVisible = true %}
  127.           {% if rowGutterSelectValue == false and rowWidth == 'full-width' %}
  128.             {% set colStickyVisible = false %}
  129.           {% endif %}
  130.           {% for col in cols.iterator %}
  131.             {% if editmode %}
  132.               <div class="editmode-col col {% if rowShade == 'bright' %}gradient-text-color-bright{% endif %}" style="border: 2px dashed rgba(0,0,0, 0.3);">
  133.                 {# {% include "areas/col/view.html.twig" with {'rowBackground': rowBackground} %} #}
  134.                 {% include "areas/col/view.html.twig" with {'rowJustify': rowJustify, 'colStickyVisible': colStickyVisible} %}
  135.               </div>
  136.             {% else %}
  137.               {% include "areas/col/view.html.twig" with {'rowJustify': rowJustify, 'colStickyVisible': colStickyVisible} %}
  138.             {% endif %}
  139.           {% endfor %}
  140.         {% else %}
  141.           {% for col in cols %}
  142.               {% include 'areas/col/view.html.twig' with col %}
  143.           {% endfor %}
  144.         {% endif %}
  145.       </div>
  146.     </div>
  147.   </section>
  148.   {% if editmode %}
  149.   {# Sets col width according to selection, only for backend view #}
  150.     <script>
  151.       (function() {
  152.         const rows = document.querySelectorAll('.c-row');
  153.         const cols = document.querySelectorAll('.c-row .editmode-col');
  154.         rows.forEach((row) => {
  155.           let childRow = row.querySelector('.row');
  156.           let blockEntry = row.querySelectorAll('.pimcore_block_entry');
  157.           let block = row.querySelector('.pimcore_editable_block');
  158.           if (block && blockEntry?.length > 0) {
  159.             childRow.classList.forEach((htmlClass) => {
  160.               block.classList.add(htmlClass);
  161.             });
  162.           }
  163.         });
  164.         cols.forEach((col) => {
  165.           let childCol = col.querySelector('.c-col');
  166.           if (childCol && childCol.dataset.width) {
  167.             col.parentElement.classList.add('col-' + childCol.dataset.width);
  168.           } else if (childCol && !childCol.dataset.width) {
  169.             col.parentElement.classList.add('col');
  170.           }
  171.         });
  172.       })();
  173.     </script>
  174.   {% endif %}
  175. {% endblock %}