<?php
/**
 * Output of the single tournament videos.
 *
 * @package cyberpress/templates
 */

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

// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound

$tournament  = cyberpress()->get_the_tournament();
$screenshots = $tournament->get_screenshots();

if ( $screenshots && ! empty( $screenshots ) ) : ?>
    <h3><?php echo esc_html__( 'Screenshots', 'cyberpress' ); ?></h3>

    <div class="cyberpress-screenshots">
        <?php
        foreach ( $screenshots as $screenshot_id ) {
            $url = wp_get_attachment_image_src( $screenshot_id, 'full' );
            ?>
            <a href="<?php echo esc_url( $url[0] ); ?>" class="cyberpress-screenshot" data-size="<?php echo esc_attr( $url[1] . 'x' . $url[2] ); ?>">
                <?php echo wp_get_attachment_image( $screenshot_id, 'large' ); ?>
                <div class="cyberpress-screenshot-overlay">
                    <?php CyberPress_Template_Parts::get_template( 'icons/search.php' ); ?>
                </div>
            </a>
            <?php
        }
        ?>
    </div>
<?php endif; ?>
