Skip to content
Snippets Groups Projects
_layout.twig 2.02 KiB
{% set section_names = {
  1: 'first',
  2: 'second',
  3: 'third',
  4: 'fourth',
  5: 'fifth',
} %}


{% if settings.layout_builder_background_color %}
  {% set classes = classes|merge(['uw-section__background-color']) %}
{% endif %}

{% if options.image %}
  {% include '@components/background-image/background-image.twig' with {
    'image': options.image,
    'image_class': 'uw-section__background-image-' ~ settings.layout_builder_background_image,
  } %}
  {% set classes = classes|merge(['uw-section__background-image-' ~ settings.layout_builder_background_image ]) %}
{% endif %}

{% set section_classes = '' %}
<section
  {% if pattern_lab %}
    class="{{ classes }}"
  {% else %}
    {{ attributes.addClass(classes) }}
  {% endif %}
>

  {% for i in 1..num_of_blocks %}

    {% set section_name = section_names[loop.index] %}

    {% if inverted_l_left or inverted_l_right %}
      {% if loop.index == 1 %}
        <div class="uw-inverted-l--left-side">
      {% endif %}

      {% if inverted_l_left and loop.index == 2 %}
          <div class="uw-inverted-l--right-side">
      {% endif %}

      {% if inverted_l_right and loop.index == 4 %}
        <div class="uw-inverted-l--right-side">
      {% endif %}

    {% endif %}

    <div
      {% if pattern_lab %}
        {% set region_classes = 'layout__region ' ~ 'layout__region--' ~ section_name %}
        class="{{ region_classes }}"
      {% else %}
        {{ region_attributes[section_name].addClass('layout__region', 'layout__region--' ~ section_name) }}
      {% endif %}
    >

      {% if pattern_lab %}
        {{ section_name }} column
      {% else %}
        {{ content[section_name] }}
      {% endif %}
    </div>

    {% if inverted_l_left or inverted_l_right %}
      {% if inverted_l_left %}
        {% if loop.index == 1 or loop.index == 4 %}
          </div>
        {% endif %}