
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
<?php
/*
@var $gallery_photos
@var $gallery_layout
@var $gallery_class
*/

$image_size = 'presso_thumbnail_square_3_full';

if ( presso_is_proofing_enabled() ) {
	$approved_list = get_post_meta( get_the_id(), 'vw_approved_photos' );
}

if ( 'grid-6' == $gallery_layout ) {
	$gallery_class[] = 'vw-flex-grid--sm-2';
	$image_size = 'presso_thumbnail_large';

} else if ( 'grid-5' == $gallery_layout ) {
	$gallery_class[] = 'vw-flex-grid--sm-2';
	$image_size = 'presso_thumbnail_large';

} else if ( 'grid-4' == $gallery_layout ) {
	$gallery_class[] = 'vw-flex-grid--sm-4';
	$image_size = 'presso_thumbnail_medium';

} else if ( 'grid-3' == $gallery_layout ) {
	$gallery_class[] = 'vw-flex-grid--sm-3';
	$image_size = 'presso_thumbnail_large';

} else if ( 'grid-2' == $gallery_layout ) {
	$gallery_class[] = 'vw-flex-grid--sm-2';
	$image_size = 'presso_thumbnail_large';

} else if ( 'grid-1' == $gallery_layout ) {
	$image_size = 'presso_thumbnail_full';
	
}
?>

<div class="vw-gallery vw-flex-grid vw-flex-grid--small-gap <?php echo esc_attr( implode( ' ', $gallery_class ) ); ?>">

	<?php foreach ( $gallery_photos as $i => $attachment_id ) : ?>
		<div class="vw-gallery__item vw-flex-grid__item">
		
			<figure>
				<div class="vw-gallery__thumbnail" style="position: relative; overflow: hidden; ">
					<?php
						$attachment = get_post( $attachment_id );
						$image_caption = $attachment->post_excerpt;

						if ( ( 'grid-5' == $gallery_layout && $i == 0 )
							|| ( 'grid-6' == $gallery_layout && $i%3 == 0 )
						 ) {
							echo wp_get_attachment_link( $attachment_id, apply_filters( 'presso_filter_gallery_grid_alt_thumbnail_size', 'presso_thumbnail_full_width' ) );
						} else {
							echo wp_get_attachment_link( $attachment_id, apply_filters( 'presso_filter_gallery_grid_thumbnail_size', $image_size ) );
						}
					?>

					<div class="vw-gallery__overlay">
						<div class="vw-gallery__icons">
							<a class="vw-gallery__zoom" href="<?php echo esc_url( wp_get_attachment_url( $attachment_id ) ); ?>" title="<?php echo esc_attr( $attachment->post_excerpt ); ?>"><i class="vw-icon icon-entypo-search"></i></a>
							<a class="vw-gallery__view" href="<?php echo esc_url( get_permalink( $attachment_id ) ); ?>"><i class="vw-icon icon-entypo-link"></i></a>

							<?php if ( presso_is_proofing_enabled() ) : ?>
							<a class="vw-gallery__proofing" href="#" data-galleryid="<?php echo esc_attr( get_the_id() ); ?>" data-photoid="<?php echo esc_attr( $attachment_id ); ?>" data-proofing="<?php echo esc_attr( in_array( $attachment_id, $approved_list )? 'approved': 'rejected' ); ?>"><i class="vw-icon icon-entypo-check"></i></a>
							<?php endif; ?>

						</div>
					</div>
				</div>

				<?php if ( presso_is_proofing_enabled() ) : ?>
					<div class="vw-gallery__proofing-id">#<?php echo esc_html( $attachment_id ); ?></div>
				<?php endif; ?>

				<?php $excerpt = trim( get_post_field( 'post_excerpt', $attachment_id ) );
				if ( $excerpt ) : ?>
					<figcaption class="vw-floating-caption" <?php presso_itemprop( 'caption' ); ?>>
						<span>
							<?php echo wp_kses_post( apply_filters( 'presso_filter_gallery_caption',  $excerpt ) ); ?>
							<?php presso_the_location_link( $attachment_id, 'icon' ); ?>
						</span>
					</figcaption>
				<?php endif; ?>

			</figure>
		</div>
	<?php endforeach; ?>

</div>