<?php
 
add_filter( 'ppt_blocks_args',  array('block_hero120',  'data') );
add_action( 'hero120',  			array('block_hero120', 'output' ) );
add_action( 'hero120-css',  		array('block_hero120', 'css' ) );
add_action( 'hero120-js',  		array('block_hero120', 'js' ) );

class block_hero120 {

	function __construct(){}		

	public static function data($a){ 
	
		global $CORE;
  
		$a['hero120'] = array(
			"name" 	=> "Hero 120",
			"image"	=> "hero120.jpg",
			"cat"	=> "hero",
			"widget" => "ppt-hero",			
			"order" => 1.9,
			"desc" 	=> "", 
			"data" 	=> array( ),
			"defaults" => array(),
					
		);		
		
		return $a;
	
	} public static function output(){ global $CORE, $settings, $hero_settings;	
	    
		 $df = array(
		 	"image" => "", //DEMO_IMGS."?fw=hero120&t=".THEME_KEY,
			"btn_show" => 1,
			"btn2_show" => 0,
			"searchboxmap" => 0,		 
		 );
		 
		 $blockdata = array();

		 if(is_array($hero_settings) && !empty($hero_settings)){

			 if(strlen($hero_settings['image']) > 1){
			 $image = $hero_settings['image'];
			 }
			 $df['btn_show'] = $hero_settings['btn_show'];
			 $df['btn2_show'] = $hero_settings['btn2_show'];
			 $df['searchboxmap'] 	= $hero_settings['searchboxmap']; 

			// CHANGE BG COLOR TO SECTION COLOR
			$custombg = "bg-dark";
			if(isset($hero_settings['section_bg']) && $hero_settings['section_bg'] !=""){
			$custombg =  $hero_settings['section_bg'];
			$hero_settings['section_bg'] = "";
			}

		 }else{	

		 	$settings =  $CORE->LAYOUT("get_block_settings_defaults_new", array("hero", "hero120" ) );
		 	foreach($df as $h => $j){
				if(isset($settings[$h]) && $settings[$h] != ""){
					$df[$h] = $settings[$h];
				}
			 } 

			// CHANGE BG COLOR TO SECTION COLOR
			$custombg = "bg-dark";
			if(isset($settings['section_bg']) && $settings['section_bg'] !=""){
			$custombg =  $settings['section_bg'];
			$settings['section_bg'] = "";
			$hero_settings['section_bg'] = "";
			}

			$hero_settings = $settings;

		 } 

		ob_start();
		
		?>

<section class="hero120 position-relative p-2">

     
    <div class="container position-relative z-10 text-light p-3 rounded-20 <?php echo $custombg; ?>">

    <div class="bg-image" style="background-image:url('<?php echo $df['image']; ?>');" data-ppt-image-bg>&nbsp;</div>



      <div class="align-items-center my-lg-5 _contents">
        <div class="col-xl-10 text-center m-auto">     
     
     <h1 data-ppt-title><?php echo $CORE->LAYOUT("get_placeholder_text_new", array("hero1", "t" ) ); ?></h1>
          
     <p class="lead mb-4 mobile-mb-4" data-ppt-subtitle><?php echo $CORE->LAYOUT("get_placeholder_text_new", array("hero1", "s" ) ); ?></p>     

<div class="mt-5 col-md-5 col-xl-6 mx-auto"> 

 
 
<form method="get" action="<?php echo home_url(); ?>">
    <div class="bg-white rounded-lg p-1 d-flex">          
    <input class="typeahead form-control form-control-lg border-0 mb-0" type="text"  name="s" placeholder="<?php echo __("Start your search here...","premiumpress"); ?>"> 
    <button data-ppt-btn class="btn-primary" type="submit">
    <span class='fa fa-search'></span>       
    </div>  

	 
</form>    

 
            

</div>
    
        </div>
      </div>


     

</div>
 
</section>
<?php
$output = ob_get_contents();
ob_end_clean();
echo ppt_theme_block_output($output, $hero_settings, array("hero", "hero120"));
	
	}
	public static function css(){ global $CORE;
ob_start();?>
<style>
@media (min-width: 1200px){
[data-ppt-blocktype="hero"] h1 {
    font-size: 40px;
}
}
</style>
        <?php
	 
		$output = ob_get_contents();
		ob_end_clean();
		echo $output;	
	
	}		
	public static function js(){ global $CORE;
		ob_start();
 
		$output = ob_get_contents();
		ob_end_clean();
		echo $output;	
	
	}	
	
}

?>