<?php
/**
 * Product image gallery.
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/hbfwc/product-gallery.php.
 *
 * @package HBFWC\Templates
 * @version 1.0.0
 */

defined( 'ABSPATH' ) || exit;

// Note: `wc_get_gallery_image_html` was added in WC 3.3.2 and did not exist prior. This check protects against theme overrides being used on older versions of WC.
if ( ! function_exists( 'wc_get_gallery_image_html' ) ) {
	return;
}

global $product;

$attachment_ids = hbfwc_get_all_attachment_ids();

if ( $attachment_ids ) {

	print '<div class="hbfwc-product__gallery">' . "\n";
	print '<div class="hbfwc-product-gallery__wrapper">';
	foreach ( $attachment_ids as $attachment_id ) {
		// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
		echo apply_filters( 'hbfwc_gallery_image_html', hbfwc_get_gallery_image_html( $attachment_id ), $attachment_id );
		// phpcs:enable
	}
	print '</div>' . "\n";
	print '</div>' . "\n";

}
