<?php 
/**
 * Template part for displaying Upcoming Events Section
 *
 *@package Rock Studio
 */
    $upcoming_events_section_title           = rock_studio_get_option( 'upcoming_events_section_title' );
    $number_of_upcoming_events_items         = rock_studio_get_option( 'number_of_upcoming_events_items' ); ?>

    <?php if( !empty($upcoming_events_section_title) ): ?>
        <div class="section-header">
            <h2 class="section-title"><?php echo esc_html($upcoming_events_section_title);?></h2>
        </div><!-- .section-header -->
    <?php endif; ?>

    <div class="section-content col-3 clear">
        <?php for( $i=1; $i<=$number_of_upcoming_events_items; $i++ ) : 
            $upcoming_events_image[$i]              = rock_studio_get_option( 'upcoming_events_image_'.$i );
            $upcoming_events_title[$i]              = rock_studio_get_option( 'upcoming_events_title_'.$i );
            $upcoming_events_content[$i]          = rock_studio_get_option( 'upcoming_events_content_'.$i );
            $upcoming_events_button_label[$i]       = rock_studio_get_option( 'upcoming_events_button_label_'.$i );
            $upcoming_events_button_url[$i]          = rock_studio_get_option( 'upcoming_events_button_url_'.$i );
        ?>          
            
        <article>
            <div class="event-item">
                <div class="featured-image" style="background-image: url('<?php echo esc_url($upcoming_events_image[$i]); ?>');">
                </div><!-- .featured-image -->

                <div class="entry-container">
                    <?php if( !empty($upcoming_events_title[$i]) || !empty($upcoming_events_content[$i]) ):?>
                        <header class="entry-header">
                            <?php if( !empty($upcoming_events_title[$i]) ):?>
                                <h2 class="entry-title"><a href="<?php echo esc_html( $upcoming_events_button_url[$i] ); ?>"><?php echo esc_html( $upcoming_events_title[$i] ); ?></a></h2>
                            <?php endif; ?>

                            <?php if( !empty($upcoming_events_content[$i]) ): ?>
                                <p><?php echo esc_html( $upcoming_events_content[$i] ); ?></p>
                            <?php endif; ?>
                        </header>
                    <?php endif; ?>

                    <?php if( !empty($upcoming_events_button_label[$i]) ):?>
                        <a href="<?php echo esc_html( $upcoming_events_button_url[$i] ); ?>" class="btn"><?php echo esc_html( $upcoming_events_button_label[$i] ); ?><i class="fas fa-angle-right"></i></a>
                    <?php endif; ?>
                </div><!-- .entry-container -->
            </div><!-- .event-item -->
        </article>
        <?php endfor; ?>
    </div><!-- .section-content -->