<?php
$would_you_like_to_add_sponsors_etc_ = get_field('would_you_like_to_add_sponsors_etc_', 'option');
$would_you_like_this_on_every_page_or_just_the_homepage = get_field('would_you_like_this_on_every_page_or_just_the_homepage', 'option');
$full_width_or_set_width = get_field('full_width_or_set_width', 'option');
if($full_width_or_set_width == 'contained'){
  $fullWidth = 'container no-pading';
} else {
  $fullWidth = '';
}
if($would_you_like_this_on_every_page_or_just_the_homepage == 'no_front_only') {
  $top = is_front_page();
} else {
  $top = 0 == 0;
}
?>

<?php if($would_you_like_to_add_sponsors_etc_ == 'yes'):?>
  <?php if($top):?>
  <div class='<?php echo $fullWidth; ?> overflow island-bottom-margin'>
<div class=''>


    <?php if( have_rows('sponsorspartnerships_etc', 'option') ): ?>

	<div class="sponsors-results">

	<?php while( have_rows('sponsorspartnerships_etc', 'option') ): the_row();

		// vars
		$image = get_sub_field('image');
		$link = get_sub_field('links_to_whatever');
    $sizes  = set_sizes_4_3_half($image);
    $img_src = wp_get_attachment_image_url($image, '4_3_small' );
		?>

		<div class="sponsors col-6 col-3-m">

			<?php if( $link ): ?>
				<a href="<?php echo $link; ?>">
			<?php endif; ?>

      <img src="/<?php echo esc_url( $img_src ); ?>" style="width:100%;"
      srcset="<?php echo esc_attr( $sizes ); ?>">

			<?php if( $link ): ?>
				</a>
			<?php endif; ?>


		</div>

	<?php endwhile; ?>

</div>


<?php endif; ?>





    </div>
    </div>
<?php endif;?>
<?php endif;?>
