<?php

// Prevent Direct Access
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$features_suptitle = get_theme_mod('features_suptitle');
$features_title = get_theme_mod('features_title');
$features = get_theme_mod('features', array());

if( $features ){

	$count = count($features);

	if($count == 1){
		$column_class = 'col-xs-12';
	}
	else if($count == 2 || $count == 4){
		$column_class = 'col-sm-6';
	}
	else{
		$column_class = 'col-sm-4';
	}
}

$section_id = get_theme_mod('features_menu_id', 'features');
?>

<section id="<?php echo $section_id ?>" class="padding">
	<div class="container">
		<div class="row">
		
			<?php if( $features_suptitle != '' || $features_title != '' ){ ?>
			<div class="col-sm-12 text-center title_block bottom30">
				<?php
				if( $features_suptitle != '' ){ echo '<p class="title bottom0">'.$features_suptitle.'</p>'; }
				if( $features_title != '' ){ echo '<h2 class="darkcolor">'.$features_title.'</h2>'; }
				?>
			</div>
			<?php } ?>
		
			<?php if( $features ){ ?>
			<div class="icon_wrap text-center clearfix">
			
				<?php foreach($features as $feature){ ?>
				<div class="<?php echo $column_class ?> top30">
					<div class="icon_box">
						<?php
						if( $feature['icon'] != '' ){ echo '<i class="'.$feature['icon'].'"></i>'; }
						if( $feature['title'] != '' ){ echo '<h4 class="bottom15">'.$feature['title'].'</h4>'; }
						if( $feature['text'] != '' ){ echo '<p class="no_bottom">'.nl2br($feature['text']).'</p>'; }
						?>
					</div>
				</div>
				<?php } ?>
				
			</div>
			<?php } ?>
			
		</div>
	</div> 
</section>