<?php
$gallery = get_field('gallery');


// Charger le script JavaScript
wp_enqueue_script('carhop-gallery-view');

?>

<section class="block-gallery gallery content-section alignwide">
	<div class="gallery__slider">
		<?php if ($gallery && is_array($gallery)) : ?>
			<div class="swiper gallery-swiper">
				<div class="swiper-wrapper">
					<?php foreach ($gallery as $image) : ?>
						<div class="swiper-slide">
							<div class="gallery-card">
								<div class="gallery-card__image">
									<img src="<?php echo $image['url'] ?? ''; ?>" alt="<?php echo $image['alt'] ?? ''; ?>" />
								</div>


							</div>
						</div>


					<?php endforeach; ?>
				</div>

				<div class="swiper-pagination-fraction"></div>
				<div class="swiper-pagination"></div>

				<div class="swiper-controls">
					<div class="swiper-button-prev"></div>
					<div class="swiper-button-next"></div>
				</div>
			</div>


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