<?php
$columns = mb_get_block_field("icon-box-columns");
$icon_boxes = mb_get_block_field("icon-boxes");

if ($icon_boxes) { ?>
<section <?= inoby_block_attrs($attributes, ["class" => "icon-boxes"]) ?>>
  <div class="container">
    <div class="row">
      <div class="col-12">
        <div class="icon-box-wrap g-col-sm-1 g-col-lg-3 g-col-<?= $columns ?>">
          <?php foreach ($icon_boxes as $icon): ?>
              <div class="icon-box <?= isset($icon["highlight_box"]) ? " highlight " : "" ?>">
                <?php
                echo isset($icon["icon"]) ? mb_inoby_picture($icon["icon"], "s-2") : "";
                echo isset($icon["headline"]) ? "<h2>" . $icon["headline"] . "</h2>" : "";
                echo isset($icon["text"]) ? "<p>" . $icon["text"] . "</p>" : "";
                echo isset($icon["button_url"]) ? '<a href="' . $icon["button_url"] . '">' . $icon["button_text"] . "</a>" : "";
                ?>
              </div>
            <?php endforeach; ?>
        </div>
      </div>
    </div>
  </div>
</section>
<?php }
