You are here

dynamic-layout-frontend.html.twig in Dynamic Layouts 8

{# Container #}
{%
  set classes = [
    'dynamic-layouts-container',
    content['#wrapperClasses'] 
  ]
%}
<div {{ attributes.addClass(classes) }}>

  {# Rows #}
  {% for row in content.rows|first %}

    {% if row.default_row_class|length %}
      <div class="dynamic-layout-row {{ row.default_row_class }} {{ row.custom_row_classes | join(' ') }}">
    {% endif %}

    {# Columns #}
    {% for column in row.columns %}

      {% set column_width_number = column.column_width_number %}
      {% if column.custom_column_width_number|length %}
        {% set column_width_number = column.custom_column_width_number %}
      {% endif %}

      <div class="dynamic-layouts-container-column layout-builder--layout__region {{ column.column_width_prefix }}-{{ column_width_number }} {{ column.default_column_class }} {{ column.custom_column_classes | join(' ') }} ">
        {{ content[column.region_name] }}
      </div>
    {% endfor %}

    {% if row.default_row_class|length %}
      </div>
    {% endif %}

  {% endfor %}
</div>

File

templates/dynamic-layout-frontend.html.twig
View source
  1. {# Container #}
  2. {%
  3. set classes = [
  4. 'dynamic-layouts-container',
  5. content['#wrapperClasses']
  6. ]
  7. %}
  8. <div {{ attributes.addClass(classes) }}>
  9. {# Rows #}
  10. {% for row in content.rows|first %}
  11. {% if row.default_row_class|length %}
  12. <div class="dynamic-layout-row {{ row.default_row_class }} {{ row.custom_row_classes | join(' ') }}">
  13. {% endif %}
  14. {# Columns #}
  15. {% for column in row.columns %}
  16. {% set column_width_number = column.column_width_number %}
  17. {% if column.custom_column_width_number|length %}
  18. {% set column_width_number = column.custom_column_width_number %}
  19. {% endif %}
  20. <div class="dynamic-layouts-container-column layout-builder--layout__region {{ column.column_width_prefix }}-{{ column_width_number }} {{ column.default_column_class }} {{ column.custom_column_classes | join(' ') }} ">
  21. {{ content[column.region_name] }}
  22. </div>
  23. {% endfor %}
  24. {% if row.default_row_class|length %}
  25. </div>
  26. {% endif %}
  27. {% endfor %}
  28. </div>