<?php /* NOTE: GENERATED BY GULP !!! */ ?><?php /* Needs: $source, $images and $count */ ?>

<?php
  if (!isset($count)) {
    $count = 1;
  }
  if (!isset($instasize)) {
    $instasize = '320x320_crop';
  }
  $custom_width = isset($imgfeed_width) ? $imgfeed_width : 320;
  $custom_height = isset($imgfeed_height) ? $imgfeed_height : 320;
?>

<div class="<?php echo $b; ?>__images">
  <?php
    $image_index = 1;
  ?>
  <?php if($source == "images"): ?>
    <?php if($images): ?>
      <?php foreach($images as $image): ?>
        <?php if($image_index <= $count): ?>
          <?php
            $src = $image["url"];
            $image_alt = $image["alt"];
          ?>
          <?php echo flo_aq_img($class = $b . "__image", $url = $src, $width = $custom_width, $height = $custom_height, $crop = true, $alt = $image_alt, $force_sizes = true); ?>

        <?php endif; ?>
        <?php
          $image_index++;
        ?>
      <?php endforeach; ?>
    <?php endif; ?>
  <?php elseif($source == "plugin"): ?>
    <?php 
      $feed_shortcode = flo_data($data, 'flo-fiji2-footer-instagram-area__shortcode');

      if (isset($feed_shortcode) && !empty($feed_shortcode)) {
        echo do_shortcode($feed_shortcode);
      } elseif (is_plugin_active('instagram-feed/instagram-feed.php')) {
          /*smash ballon was the recommended plugin for IG feed, we need this 
          * for clients that already used the feed shortcode before theme update
          */
          echo do_shortcode('[instagram-feed]');
      } else {

        $accountID = flo_data($data, "flo-instagram-footer-account"); 
        if(!$accountID) {
          $accountID = get_option("flo_instagram_user_id");
        }

        if( is_plugin_active('flo-instagram/flo-instagram.php')) {         
          echo  do_shortcode('[flo_instagram padding="0" use_pattern="" picture_sizes="'.$instasize.'" link="1" nr_columns="'.$count.'" limit="'.$count.'" new_user_id="'.$accountID.'" user_id="" access_token="" ]');
        }
      }
    ?>
  <?php endif; ?>
</div>
