<?php
// SET CHILD THEME FLAG
define('WLT_CHILDTHEME', 1);

// FRAMEWORK STYLES
define('WLT_FRAMEWORKTHEME', 1);

$CHILDTHEME	= new childtheme_directorytheme_10;
 
class childtheme_directorytheme_10 {

	function __construct(){ 
		
		if(is_admin()){		
			 
			// ADD DEFAULT ELEMENTOR TEMPLATE TO ADMIN PABEL
			add_filter('hook_v9_admin_elementor_templates', array($this, '_elementor_templates'), 2 );				
			
		} 
		 
		// IMAGES
		add_action('hook_admin_2_homeedit', array($this, '_hook_admin_2_homeedit' ) );			
		  
 		// ACTIVATION
		add_action('after_switch_theme', array($this, '_after_switch_theme') );
 
		
	} // end construct	
 
	
	function _elementor_templates($c){
	 
		$c['homepage'] = array(
			"image" 			=> str_replace("img/","",CHILD_THEME_PATH_IMG)."screenshot.png",
			"name" 			=> "Homepage Design",
			"description" 	=> "Here you can install the home page template file that can be modified using the Elementor page builder plugin.",
			"video" 		=> "",
			"file" 			=> __DIR__ ."/homepage.json",
			"homepage"		=> true,
			"page_template"	=> "elementor_header_footer",
		);
	 
		
		return $c;
	}
	
	
 	function _hook_admin_2_homeedit($c){
	
		$new = array(		 
	 
			'hero' => array(		
				"n" => "Hero Image", 
				"desc" => "These images form the hero on your homepage.",
				"data" => array(
				
					"img1" 		=> array( "t" => "Big Image 1 (510x550 pixels)","type" => "upload", "d" => home_url()."/wp-content/themes/childtheme_directory_10/img/user.png"  ), 					
					"txt1" 	=> array( "t" => "Title Text","type" => "text", "d" => "Online Directory Website"  ), 
				 	"txt2" 	=> array( "t" => "Subtitle Text ","type" => "text", "d" => "Find local businesses in your area today!"  ), 
					 
					"btntxt" 	=> array( "t" => "Btn Text","type" => "text", "d" => "Browse Website"  ),
				 	"btnlink" 	=> array( "t" => "Btn Link","type" => "text", "d" => home_url()."/?s="  ),
					
				),		 	
			),
			
			
	'ctitle1' => array(
				"n" => "Title Heading 1", 
					"data" => array(
					
						"txt1" 	=> array( "t" => "Title Text","type" => "text", "d" => "SEARCH BY CATEGORY" ),
						"txt2" 	=> array( "t" => "Description Text","type" => "textarea", "d" => "We've group everything by category to make things easier!" ),	 
					),			
				),
				
			'ctitle2' => array(
				"n" => "Title Heading 2", 
					"data" => array(
					
						"txt1" 	=> array( "t" => "Title Text","type" => "text", "d" => "FEATURED LISTINGS" ),
						"txt2" 	=> array( "t" => "Description Text","type" => "textarea", "d" => "Some noteworthy listings you might find interesting." ),	 
					),			
				),
			 
			
		); 
 
		return array_merge($c,$new); 
	}
	
	/*
		this function holds all of the changes
		made to core when the child theme is activated
	*/
	function childtheme_v_changes(){
	
		$core = get_option("core_admin_values"); 
		
		//$core['light_logo_url'] = CHILD_THEME_PATH_IMG."logo-light.png"; 
		$core['logo_url'] = CHILD_THEME_PATH_IMG."logo.png";
		
		// RETURN CORE
		return $core;		
	} 
	/*
		this function applies changes to core
		when the child theme is activated
	*/
	function _after_switch_theme(){
		// GET DESIGN FROM FUNCTION
		$core_admin_values = $this->childtheme_v_changes();
		// SAVE VALUES
		update_option('core_admin_values',$core_admin_values);
			
	}

} 
  

?>