<?php
	$phone = get_field('phone', 'options');
	$phone_nice = str_replace(' ', '', $phone);
	$email = get_field('email', 'options');
?>
<div class="contact-details-wrapper">
	<p>T: <a href="tel:<?php echo $phone_nice; ?>"><?php echo $phone; ?></a></p>
	<p><a href="mailto:<?php echo $email; ?>"><?php echo $email; ?></a></p>
	<hr>
	<?php if( have_rows( 'social_media', 'options' ) ):
		echo '<div class="social-wrapper">';
		echo '<p>Connect with us</p>';
		while ( have_rows( 'social_media', 'options' ) ) : the_row();
			if( get_row_layout() == 'facebook' ):
				$link = get_sub_field( 'link' );
				echo '<a href=" '. $link .'" class="social-link facebook"><i class="fa fa-facebook" aria-hidden="true"></i></a>';
			elseif( get_row_layout() == 'instagram' ): 
				$link = get_sub_field( 'link' );
				echo '<a href=" '. $link .'" class="social-link instagram"><i class="fa fa-instagram" aria-hidden="true"></i></a>';
			elseif( get_row_layout() == 'linkedin' ): 
				$link = get_sub_field( 'link' );
				echo '<a href=" '. $link .'" class="social-link linkedin"><i class="fa fa-linkedin" aria-hidden="true"></i></a>';
			elseif( get_row_layout() == 'twitter' ): 
				$link = get_sub_field( 'link' );
				echo '<a href=" '. $link .'" class="social-link twitter"><i class="fa fa-twitter" aria-hidden="true"></i></a>';
			elseif( get_row_layout() == 'youtube' ): 
				$link = get_sub_field( 'link' );
				echo '<a href=" '. $link .'" class="social-link youtube"><i class="fa fa-youtube" aria-hidden="true"></i></a>';
			elseif( get_row_layout() == 'vimeo' ): 
				$link = get_sub_field( 'link' );
				echo '<a href=" '. $link .'" class="social-link vimeo"><i class="fa fa-vimeo" aria-hidden="true"></i></a>';
			endif;

		endwhile;
		echo '</div>';
	else :
		// no layouts found
	endif; ?>
</div>