<?php
$references = mb_get_block_field("component-references");
//slider settings
$per_slide = mb_get_block_field("component-references-slider-slides");
$num_of_slides = count($references);

$id = uniqid("references-slider-wrapper");

if ($references) { ?>
<section <?= inoby_block_attrs($attributes, ["class" => "component-references"]) ?>>
  <div class="container">
    <div class="row">
      <div class="col-12 col-sm-12">
        <div
          <?= inoby_block_attrs($attributes, ["class" => "references-slider", "id" => $id, "data-slides" => $per_slide, "data-numslides" => $num_of_slides]) ?>>
          <?php foreach ($references as $reference): ?>
          <div class="reference-box">
            <div class="content-box">
              <?php
              if (!empty($reference["heading"])) {
                echo "<h4>" . $reference["heading"] . "</h4>";
              }
              if (!empty($reference["reference"])) {
                echo "<p>" . $reference["reference"] . "</p>";
              }
              ?>
            </div>
            <div class="author-box">
              <?php
              if (!empty($reference["author-image"])) {
                echo '<div class="author-image">';
                echo mb_inoby_picture($reference["author-image"], "s-2", ["sm" => "s-2", "md" => "s-2", "lg" => "s-2"], 100);
                echo "</div>";
              }
              if (!empty($reference["author"])) {
                echo '<div class="author-content"><p class="small">' . $reference["author"] . "</p></div>";
              }
              ?>
            </div>
          </div>
          <?php endforeach; ?>
        </div>
      </div>
    </div>
  </div>
</section>
<?php }
