<?php
$_enable = $this->getConfig('sw_socialfeeds/instagram_photos/enable');
if($_enable==1){
    $accesstoken = $this->getConfig('sw_socialfeeds/instagram_photos/accesstocken');
    $count = $this->getConfig('sw_socialfeeds/instagram_photos/showing_counts');
    $padding = $this->getData("padding_item")!=''?'padding:'.$this->getData("padding_item").';':'';
?>
    <div class="insta-items grid-items">
        <div id="instafeed" class="photo-instagrams row" style="margin-left: -<?php echo $this->getData("padding_item"); ?>;margin-left: -<?php echo $this->getData("padding_item");?>;"></div>
    </div>
    <script type="text/javascript">
        require([
            'jquery',
            'instafeed'
        ], function ($,Instafeed) {
          var feed = new Instafeed({
            accessToken: '<?php echo $accesstoken;?>',
            template: '<div class="item col-xl-2 col-lg-3 col-sm4 col-6" style="<?php echo $padding;?>"><a lass="image-link" href="{{link}}"><img class="instagram-image" title="{{caption}}" src="{{image}}" /><span class="content"><i class="porto-icon-instagram"></i></span></a></div>',
            limit: <?php echo $count;?>,
            filter: function(image) {
              return image.type === 'image';
            }
          });
          feed.run();
        });
    </script>
<?php }?>
