<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use Prodigy\Includes\Helpers\Prodigy_Formatting;

?>

<template id="gallery-thumbs-slide">
	<?php
	$attachments_default = array(
		'versions' => array(
			'thumbnails'        => '',
			'thumbnails_retina' => '',
		),
	);
	?>
	<?php
	echo wp_kses( apply_filters(
		'prodigy_single_product_image_thumbnail_html',
		prodigy_get_remote_gallery_image_html( $attachments_default, 0 ),
		$attachments_default
	), Prodigy_Formatting::get_allowed_html() );
	?>
</template>

<?php if ( ! empty( $attachments ) ) : ?>
	<div
			id="gallery-thumbs"
			class="prodigy-product__gallery-thumbs swiper prodigy-custom-template"
			data-slides="<?php echo isset( $settings ) ? esc_attr( $settings['style_thumbnails_slides'] ) : 3; ?>"
			data-spacing="<?php echo isset( $settings ) ? esc_attr( $settings['style_thumbnails_spacing']['size'] ) : 10; ?>"
	>
		<div class="swiper-wrapper">
			<?php
			foreach ( $attachments as $image_id => $attachment ) {
				echo wp_kses( apply_filters( 'prodigy_single_product_image_thumbnail_html', prodigy_get_remote_gallery_image_html( $attachment, $image_id ), $attachment ), Prodigy_Formatting::get_allowed_html() );
			}
			?>
		</div>
		<button
				class="prodigy-product__gallery-nav prodigy-product__gallery-nav-prev icon icon-arrow-left"
				aria-label="<?php esc_attr_e( 'Previous slide', 'prodigy-commerce' ); ?>"
				style="display: none;"
				type="button"
		></button>
		<button
				class="prodigy-product__gallery-nav prodigy-product__gallery-nav-next icon icon-arrow-right"
				aria-label="<?php esc_attr_e( 'Next slide', 'prodigy-commerce' ); ?>"
				style="display: none;"
				type="button"
		></button>
	</div>
<?php endif; ?>
<?php
