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

class block_listings100 {

	function __construct(){}		

	public static function data($a){ global $CORE; 
  
		$a['listings100'] = array(
			"name" 	=> "Block of 12",
			"image"	=> "listings100.jpg",
			"cat"	=> "listings",
			
			"desc" 	=> "", 
			"widget"	=> "ppt-listings",
			"data" 	=> array( ),	
			
			"defaults" => array( ),

			"order" => 1.1,
			
					
		);		
		
		return $a;
	
	} public static function output(){ global $CORE, $listing_settings, $df; 
	
	
		// ALL DEFAULT FIELDS
		 $df = ppt_theme_blocks_defaults("listings"); 
		  
		// APPLY CUSTOM CHANGES 
		$cc = array(

			"tax" 		=> "listing",
			"btn_show" 	=> 1,
			"btn_txt" 	=> $CORE->LAYOUT("get_placeholder_text_new", array("short", "more" ) ),
			"title" 	=> $CORE->LAYOUT("get_placeholder_text_new", array("short", "featured_listings" ) ),
			"subtitle" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
			"show" 		=> 12,

		 );
		 

		$df = array_merge($df, $cc);
		
		
		// 1. ELEMENTOR
		if(!empty($listing_settings)){
			foreach($df as $k => $v){				
				if(isset($listing_settings[$k]) && $listing_settings[$k] != "" ){
					$df[$k] = $listing_settings[$k];
				}
			}
			
		// 2. HOME DESIGNS		
		}else{	
			 
		 	$settings =   $CORE->LAYOUT("get_block_settings_defaults_new", array("listings", "listings100"  ) );
		 
		 	foreach($df as $h => $j){
				if(isset($settings[$h]) && $settings[$h] != ""){
					$df[$h] = $settings[$h];
				}
			 } 
		}
		 
		
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
	 
 
$data =  do_shortcode('[LISTINGS nav=0 small=1 show="'.$df['show'].'" order="'.$df['order'].'" custom="'.$df['custom'].'" orderby="'.$df['orderby'].'" card="'.$df['card'].'" perrow="'.$df['perrow'].'"  ]');		
 
	ob_start();
	
	?>

<section class="section-60">
  <div class="container">
    <div class="row">



    <?php if(strlen($df['title']) > 1){ ?>
      <div class="col-md-12">
        <div <?php if($df['btn_show'] == "1" && strlen($df['btn_txt']) > 2){ ?> class="d-flex justify-content-between align-items-center"<?php } ?>>

		<div>

          <h2 data-ppt-title><?php echo $df['title']; ?></h2>

		 <?php if(strlen($df['subtitle']) > 2){ ?> 
		  <p data-ppt-subtitle><?php echo $df['subtitle']; ?></p>
		  <?php } ?>

		</div>
          
        <?php if($df['btn_show'] == "1" && strlen($df['btn_txt']) > 2){ ?>
			<div class="justify-content-center">
            <a href="<?php echo home_url(); ?>/?s=" data-ppt-btn data-ppt-btn-link class="btn-system btn-rounded-25 btn-md"><?php echo $df['btn_txt']; ?></a>
            </div>
		<?php } ?>
          
        </div>
      </div>
      <?php } ?>



      <div class="col-12">
        %data%
      </div>
    </div>
  </div>
</section>
<?php
		$output = ob_get_contents();
		ob_end_clean();
echo str_replace("%data%", $data,ppt_theme_block_output($output, $df, array("listings", "listings100")));
	
	}
	
		public static function js(){
		return "";
		}	
		 
		public static function css(){
		return "";
		 }	
		 
}

?>