<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}
?>
<div class="swiper etn-egr-swiper-container">
    <div class="swiper-wrapper">
        <?php foreach ( $data['reviews'] as $etn_egr_r ) : ?>
            <div class="swiper-slide">
                <div class="etn-egr-card">
                    <span class="etn-egr-author-name"><?php echo esc_html( $etn_egr_r['author_name'] ?? '' ); ?></span>
                    <div class="etn-egr-stars">
                        <?php for ( $etn_egr_i = 0; $etn_egr_i < (int) ( $etn_egr_r['rating'] ?? 0 ); $etn_egr_i++ ) { echo '<span class="etn-egr-star">★</span>'; } ?>
                    </div>
                    <p class="etn-egr-text">
                        <?php
                        $etn_egr_t = esc_html( $etn_egr_r['text'] ?? '' );
                        if ( strlen( $etn_egr_t ) > 120 ) {
                            echo esc_html( substr( $etn_egr_t, 0, 120 ) ) . '... <a href="#" class="etn-egr-read-more" data-full="' . esc_attr( $etn_egr_t ) . '">' . esc_html__( 'Read more', 'etchenet-reviews-for-google-business' ) . '</a>';
                        } else {
                            echo esc_html( $etn_egr_t );
                        }
                        ?>
                    </p>
                </div>
            </div>
        <?php endforeach; ?>
    </div>
    <div class="swiper-pagination"></div>
</div>

<div id="etn-egr-modal" class="etn-egr-modal">
    <div class="etn-egr-modal-content">
        <span class="close-modal">&times;</span>
        <div id="modal-text"></div>
    </div>
</div>