templates/document/areabricks/link-brick/view.html.twig line 1

Open in your IDE?
  1. {% set columnCount = pimcore_select('columnCount').getData()|default(1) %}
  2. {% set gridClasses = 'grid-cols-1' %}
  3. {% if columnCount % 3 == 0 %}
  4.     {% set gridClasses = gridClasses ~ ' lg:grid-cols-3' %}
  5. {% elseif columnCount % 2 == 0 %}
  6.     {% set gridClasses = gridClasses ~ ' lg:grid-cols-2' %}
  7. {% endif %}
  8. <div class="grid {{ gridClasses }} mx-auto gap-3 py-3 px-2 bg-white">
  9.     {% for i in range(1, columnCount) %}
  10.         <div class="relative h-56 overflow-hidden bg-center bg-cover md:h-64"
  11.             {% if not editmode %}
  12.                 {% set image = pimcore_image("background-" ~ i).getThumbnail('targetaudience-background') %}
  13.                 style="background-image: url('{{ image }}');"
  14.                 href="#"
  15.             {% endif %}
  16.         >
  17.             {% if editmode %}
  18.                 {{ pimcore_image("background-" ~ i, {
  19.                     "thumbnail": "targetaudience-background",
  20.                     "class": "w-full",
  21.                 }) }}
  22.             {% endif %}
  23.               {% set link = pimcore_link("link" ~ i, {
  24.                     'placeholder': 'Link',
  25.                     "class": "flex items-center pt-1",
  26.                 }) %}
  27.             {% if editmode or not editmode and link.text  %}
  28.             <div class="absolute z-10 transform -translate-x-1/2 -translate-y-1/2" style="top: 50%; left: 50%;">
  29.                 {% include "component/button.html.twig" with { text: editmode ? link : link.text, type: "primary", icon_after: 'arrow-right-tail', attr: { "href": link.href } } only %}
  30.             </div>
  31.             {% endif %}
  32.         </div>
  33.     {% endfor %}
  34. </div>