<?php
/**
 * The template part for displaying the contact section on homepage
 *
 * @package Meridian One
 * @since 1.0
 */
?>
<?php

	$title = false;
	$subtitle = false;
	$shortcode = false;
	$map = false;

	if ( meridian_one_get_theme_option( 'home_contact_section_title' ) ) {
		$title = meridian_one_get_theme_option( 'home_contact_section_title' );
	}

	if ( meridian_one_get_theme_option( 'home_contact_section_subtitle' ) ) {
		$subtitle = meridian_one_get_theme_option( 'home_contact_section_subtitle' );
	}

	if ( meridian_one_get_theme_option( 'home_contact_section_form_shortcode' ) ) {
		$shortcode = meridian_one_get_theme_option( 'home_contact_section_form_shortcode' );
	}

	if ( meridian_one_get_theme_option( 'home_contact_section_map_url' ) ) {
		$map = meridian_one_get_theme_option( 'home_contact_section_map_url' );
	}	

?>
<div id="contact" class="section section-contact">

	<div class="section-contact-main no-col-spacing clearfix">
		
		<?php if ( $map ) : ?>
			
			<div class="section-contact-map col col-6">
				<iframe src="<?php echo esc_attr( $map ); ?>" style="border:0" allowfullscreen></iframe>
			</div><!-- .section-contact-map -->

			<div class="section-contact-form col col-6 col-last">
				<?php if ( $title ) : ?>
					<h2 class="section-title"><?php echo esc_html( $title ); ?></h2>
				<?php endif; ?>
				<?php if ( $subtitle ) : ?>
					<h3 class="section-subtitle"><?php echo esc_html( $subtitle ); ?></h3>
				<?php endif; ?>
				<?php if ( $shortcode ) : ?>
					<?php echo do_shortcode( esc_html( $shortcode ) ); ?>
				<?php endif; ?>
			</div><!-- .section-contact-form -->

		<?php else : ?>

			<div class="wrapper">

				<div class="section-contact-form">
					<?php if ( $title ) : ?>
						<h2 class="section-title"><?php echo esc_html( $title ); ?></h2>
					<?php endif; ?>
					<?php if ( $subtitle ) : ?>
						<h3 class="section-subtitle"><?php echo esc_html( $subtitle ); ?></h3>
					<?php endif; ?>
					<?php if ( $shortcode ) : ?>
						<?php echo do_shortcode( esc_html( $shortcode ) ); ?>
					<?php endif; ?>
				</div><!-- .section-contact-form -->

			</div><!-- .wrapper -->

		<?php endif; ?>

	</div><!-- .section-contact-main -->

	<?php if ( is_active_sidebar( 'sidebar-home-contact' ) ) : ?>
		<div class="section-contact-extra">
			<div class="wrapper clearfix">
				<?php dynamic_sidebar( 'sidebar-home-contact' ); ?>
			</div><!-- .wrapper -->
		</div><!-- .setion-contact-extra -->
	<?php endif; ?>

</div><!-- .section-contact -->