<?php
$counters = mb_get_block_field("component-counter"); //number, symbol, headline
$columns = mb_get_block_field("inoby-counter-columns") ?? 3;

if ($counters) { ?>
<section <?= inoby_block_attrs($attributes, ["class" => "component-counter"]) ?>>
  <div class="container">
    <div class="row">
      <div class="col-12">
        <?php
          echo '<div class="counter-wrap columns-' . intval($columns) . '">';
          foreach ($counters as $counter) {
            echo '<div class="counter">';
            echo '<div class="headline-wrap">';
            echo isset($counter["headline"]) ? "<h6>" . $counter["headline"] . "</h6>" : "";
            echo '</div>';
            echo '<div class="number-wrap">';
            echo isset($counter["number"]) ? "<span class='number' data-target='" . intval($counter["number"]) . "'>0</span>" : "";
            echo isset($counter["symbol"]) ? "<span class='symbol'>" . $counter["symbol"] . "</span>" : "";
            echo "</div>";
            echo "</div>";
          }
          echo "</div>";
          ?>
      </div>
    </div>
  </div>
</section>
<?php }