<?php
$bosa_construction_company_blog_brand_title 	= get_theme_mod( 'bosa_construction_company_blog_brand_title','' );
$bosa_construction_company_blog_brand_desc 		= get_theme_mod( 'bosa_construction_company_blog_brand_desc','' );
$bosa_construction_company_blog_brand_one_ID 	= get_theme_mod( 'bosa_construction_company_blog_brand_image_one','' );
$bosa_construction_company_blog_brand_two_ID 	= get_theme_mod( 'bosa_construction_company_blog_brand_image_two','' );       
$bosa_construction_company_blog_brand_three_ID  = get_theme_mod( 'bosa_construction_company_blog_brand_image_three','' );
$bosa_construction_company_blog_brand_four_ID 	= get_theme_mod( 'bosa_construction_company_blog_brand_image_four','' );
$bosa_construction_company_blog_brand_five_ID 	= get_theme_mod( 'bosa_construction_company_blog_brand_image_five','' );
$bosa_construction_company_blog_brand_six_ID 	= get_theme_mod( 'bosa_construction_company_blog_brand_image_six','' );

$bosa_construction_company_brand_array = array();
$bosa_construction_company_has_brand = false;
$bosa_construction_company_has_brand_content = false;
$bosa_construction_company_has_brand_number = 0;

if( !empty( $bosa_construction_company_blog_brand_title ) || !empty( $bosa_construction_company_blog_brand_desc )) {
	$bosa_construction_company_has_brand_content = true;
}
if( !empty( $bosa_construction_company_blog_brand_one_ID ) ){
	$bosa_construction_company_blog_brand_one  = wp_get_attachment_image_src( $bosa_construction_company_blog_brand_one_ID,'bosa-construction-company-590-310');
 	if ( is_array(  $bosa_construction_company_blog_brand_one ) ){
 		$bosa_construction_company_has_brand = true;
   	 	$bosa_construction_company_blog_brand_one = $bosa_construction_company_blog_brand_one[0];
   	 	$bosa_construction_company_brand_array['image_one'] = array(
			'ID' => $bosa_construction_company_blog_brand_one,
		);	
  	}
}
if( !empty( $bosa_construction_company_blog_brand_two_ID ) ){
	$bosa_construction_company_blog_brand_two = wp_get_attachment_image_src( $bosa_construction_company_blog_brand_two_ID,'bosa-construction-company-590-310');
	if ( is_array(  $bosa_construction_company_blog_brand_two ) ){
		$bosa_construction_company_has_brand = true;	
        $bosa_construction_company_blog_brand_two = $bosa_construction_company_blog_brand_two[0];
        $bosa_construction_company_brand_array['image_two'] = array(
			'ID' => $bosa_construction_company_blog_brand_two,
		);	
  	}
}
if( !empty( $bosa_construction_company_blog_brand_three_ID ) ){	
	$bosa_construction_company_blog_brand_three = wp_get_attachment_image_src( $bosa_construction_company_blog_brand_three_ID,'bosa-construction-company-590-310');
	if ( is_array(  $bosa_construction_company_blog_brand_three ) ){
		$bosa_construction_company_has_brand = true;
      	$bosa_construction_company_blog_brand_three = $bosa_construction_company_blog_brand_three[0];
      	$bosa_construction_company_brand_array['image_three'] = array(
			'ID' => $bosa_construction_company_blog_brand_three,
		);	
  	}
}
if( !empty( $bosa_construction_company_blog_brand_four_ID ) ){	
	$bosa_construction_company_blog_brand_four = wp_get_attachment_image_src( $bosa_construction_company_blog_brand_four_ID,'bosa-construction-company-590-310');
	if ( is_array(  $bosa_construction_company_blog_brand_four ) ){
		$bosa_construction_company_has_brand = true;
      	$bosa_construction_company_blog_brand_four = $bosa_construction_company_blog_brand_four[0];
      	$bosa_construction_company_brand_array['image_four'] = array(
			'ID' => $bosa_construction_company_blog_brand_four,
		);	
  	}
}

if( !empty( $bosa_construction_company_blog_brand_five_ID ) ){	
	$bosa_construction_company_blog_brand_five = wp_get_attachment_image_src( $bosa_construction_company_blog_brand_five_ID,'bosa-construction-company-590-310');
	if ( is_array(  $bosa_construction_company_blog_brand_five ) ){
		$bosa_construction_company_has_brand = true;
      	$bosa_construction_company_blog_brand_five = $bosa_construction_company_blog_brand_five[0];
      	$bosa_construction_company_brand_array['image_five'] = array(
			'ID' => $bosa_construction_company_blog_brand_five,
		);	
  	}
}
if( !empty( $bosa_construction_company_blog_brand_six_ID ) ){	
	$bosa_construction_company_blog_brand_six = wp_get_attachment_image_src( $bosa_construction_company_blog_brand_six_ID,'bosa-construction-company-590-310');
	if ( is_array(  $bosa_construction_company_blog_brand_six ) ){
		$bosa_construction_company_has_brand = true;
      	$bosa_construction_company_blog_brand_six = $bosa_construction_company_blog_brand_six[0];
      	$bosa_construction_company_brand_array['image_six'] = array(
			'ID' => $bosa_construction_company_blog_brand_six,
		);	
  	}
}
$bosa_construction_company_has_brand_number = count($bosa_construction_company_brand_array);
if( !get_theme_mod( 'bosa_construction_company_disable_popular_brands_section', true ) && ( $bosa_construction_company_has_brand || $bosa_construction_company_has_brand_content) ){ ?>
	<section class="section-brand-area">
		<?php if ( $bosa_construction_company_has_brand_content ){?>
			<div class="brand-section-info col-lg-6 offset-lg-3 col-md-8 offset-md-2">
				<h2 class="brand-section-title">
					<?php echo esc_html( $bosa_construction_company_blog_brand_title ); ?>
				</h2>	
				<p class="brand-section-desc">
					<?php echo esc_html( $bosa_construction_company_blog_brand_desc ); ?>
				</p>
			</div>
		<?php } ?>
		<div class="brand-slider_container" attribute="<?php echo esc_html($bosa_construction_company_has_brand_number); ?>">
			<div class="brand-slider">
				<?php foreach( $bosa_construction_company_brand_array as $bosa_construction_company_each_brand ){ ?>
					<figure class= "featured-image">
						<img src="<?php echo esc_url( $bosa_construction_company_each_brand['ID'] ); ?>">
					</figure>
				<?php } ?>
			</div>
		</div>
	</section>
<?php } 