<?php
$columns = mb_get_block_field("partners-columns");

$partners = mb_get_block_field("partners");

if ($partners) { ?>
<section <?= inoby_block_attrs($attributes, ["class" => "partners"]) ?>>
  <div class="container">
    <div class="row">
      <div class="col-12">
        <div class="partners-wrap g-col-md-2 g-col-<?= $columns ?>">
          <?php if (is_array($partners) || is_object($partners)) {
            foreach ($partners as $partner):
              echo '<div class="partner">';
              $partners_url = $partner["partner_url"] ?? "";
              if ($partners_url) {
                echo isset($partners_url) ? '<a class="partner-link" target="_blank" href="' . $partners_url . '">' : "";
                echo isset($partner["partner_logo"]) ? mb_inoby_picture($partner["partner_logo"], "medium") : "";
                echo "</a>";
              } else {
                echo isset($partner["partner_logo"]) ? mb_inoby_picture($partner["partner_logo"], "medium") : "";
              }
              echo "</div>";
            endforeach;
          } ?>
        </div>
      </div>
    </div>
  </div>
</section>
<?php }
