{% if sections or title or text %}

{% if quantity >= 4 %}
  {% set nbCol = 3 %}
{% elseif quantity == 3 %}
  {% set nbCol = 4 %}
{% elseif quantity == 2 %}
  {% set nbCol = 6 %}
{% elseif quantity == 1 %}
  {% set nbCol = 12 %}
{% endif %}

<section class="m_column" m-pack="basic">
  {% include 'm_components/widgets/headline.twig' with { title: title, text: text } only %}

  {% if sections %}
  <div class="grid">

    {% for section in sections %}
    <{% if section.button_link %}a href="{{ section.button_link|raw }}" {% else %}article{% endif %} class="m_column__block cs--4 clg--{{ nbCol }} ">


        {# image #}
        {% if section.image %}
        <div class="m_column__image " >
          {% include 'm_components/widgets/picture.twig' with {image: section.image, title: section.title} only %}
        </div>
        {% endif %}

        <div class="m_column__content">
          {# title #}
          {% if section.title %}
            <h2 class="h3">{{section.title|raw}}</h2>
          {% endif %}

          {# text #}
          {% if section.text %}
            <div class="m_content"> {{ fn.apply_filters('the_content', fn.html_entity_decode(section.text) )|raw }} </div>
          {% endif %}
          {% if section.button_link %}<strong class="more">Read more</strong>{% endif %}
        </div>

        </{% if section.button_link %}a{% else %}article{% endif %}>
    {% endfor %}
    </div>
  {% endif %}

  {% if button_link %}
    {% include 'm_components/widgets/link.twig' with { textBtn: button_text, link:button_link } only %}
  {% endif %}
</section>

{% endif %}
