<?php
if ( ! get_theme_mod( 'corporaze_enable_cta_section', false ) ) {
	return;
}

$section_content                   = array();
$section_content['title']          = get_theme_mod( 'corporaze_cta_title' );
$section_content['text']           = get_theme_mod( 'corporaze_cta_text' );
$section_content['background_url'] = get_theme_mod( 'corporaze_cta_background_image' );
$section_content['button_label']   = get_theme_mod( 'corporaze_cta_button_label' );
$section_content['button_link']    = get_theme_mod( 'corporaze_cta_button_link' );
$section_content['button_link']    = ! empty( $section_content['button_link'] ) ? $section_content['button_link'] : '#';

$section_content = apply_filters( 'corporaze_cta_section_content', $section_content );

corporaze_render_cta_section( $section_content );

/**
 * Render CTA Section
 */
function corporaze_render_cta_section( $section_content ) {

	?>
	<section id="corporaze_cta_section" class="corporaze-frontpage-section corporaze-cta-section section-has-background cta-style-1" style="background-color: #727272;">
		<?php
		if ( is_customize_preview() ) :
			corporaze_section_link( 'corporaze_cta_section' );
		endif;
		?>
		<?php if ( ! empty( $section_content['background_url'] ) ) { ?>
		<div class="corporaze-cta-background-img">
			<img src="<?php echo esc_url( $section_content['background_url'] ); ?>">
		</div>
		<?php } ?>
		<div class="ascendoor-wrapper">
			<div class="corporaze-cta-wrapper">
				<div class="corporaze-cta-text">
					<div class="section-header-subtitle">
						<h3 class="section-title corporaze-cta-head"><?php echo esc_html( $section_content['title'] ); ?></h3>
						<p class="section-subtitle video-detail-subtitle"><?php echo esc_html( $section_content['text'] ); ?></p>
					</div>
					<?php if ( ! empty( $section_content['button_label'] ) ) : ?>
					<div class="corporaze-cta-button corporaze-button corporaze-button-alternate">
						<a href="<?php echo esc_url( $section_content['button_link'] ); ?>"><?php echo esc_html( $section_content['button_label'] ); ?></a>
					</div>
					<?php endif; ?>
				</div>
			</div>
		</div>
	</section>
	<?php
}
