<?php

 
	
	function health_customize_page_loader_tab($wp_customize, $theme_name){
	
		$wp_customize->add_section( 'health_page_loader_settings' , array(
		    'title'      => esc_html__( 'Page Loader', 'health' ),
		    'priority'   => 20,
		) );
		
		
 
 		/**
		 * 
		 * loader
		 * 
		 */
		 
		 $wp_customize->add_setting( 'health_page_loader_img' , array(
			'default'     => '',
			'transport'   => 'refresh',
			'sanitize_callback' => 'sanitize_text_field'
		) );
		$wp_customize->add_control(
	        new WP_Customize_Image_Control(
	            $wp_customize,
	            'health_page_loader_img',
				array(
				   'label'      => esc_html__( 'Image', 'health' ),
				   'section'    => 'health_page_loader_settings',
				   'context'    => 'health_page_loader_img',
				   'settings'   => 'health_page_loader_img',
				   'priority'   => 60
				)
	       )
	    );
	    
	    $wp_customize->add_setting( 'health_page_loader_img_width' , array(
		    'default'     => '',
		    'transport'   => 'refresh',
			'sanitize_callback' => 'sanitize_text_field'
		) );
		$wp_customize->add_control(
			'health_page_loader_img_width',
			array(
				'label'    => esc_html__( 'Image width', 'health' ),
				'section'  => 'health_page_loader_settings',
				'settings' => 'health_page_loader_img_width',
				'type'     => 'text',
				 
				'priority'   => 110
			)
		);
		
		$wp_customize->add_setting( 'health_page_loader_img_height' , array(
		    'default'     => '',
		    'transport'   => 'refresh',
			'sanitize_callback' => 'sanitize_text_field'
		) );
		$wp_customize->add_control(
			'health_page_loader_img_height',
			array(
				'label'    => esc_html__( 'Image height', 'health' ),
				'section'  => 'health_page_loader_settings',
				'settings' => 'health_page_loader_img_height',
				'type'     => 'text',
				 
				'priority'   => 110
			)
		);
		
		
		$wp_customize->add_setting( 'health_page_loader_settings_use' , array(
		    'default'     => 'off',
		    'transport'   => 'refresh',
			'sanitize_callback' => 'sanitize_text_field'
		) );
		$wp_customize->add_control(
			'health_page_loader_settings_use',
			array(
				'label'    => esc_html__( 'Loader', 'health' ),
				'section'  => 'health_page_loader_settings',
				'settings' => 'health_page_loader_settings_use',
				'type'     => 'select',
				'choices'  => array(
					'off'  => esc_html__( 'Off', 'health' ),
					'usemain' => esc_html__( 'Use on main', 'health' ),
					'useall' => esc_html__( 'Use on all pages', 'health' ),
				),
				'priority'   => 110
			)
		);
		
		/**
		 * 
		 * Animation In
		 * 
		 */
		
		$wp_customize->add_setting( 'health_page_loader_animation_in' , array(
		    'default'     => 'fade-in',
		    'transport'   => 'refresh',
			'sanitize_callback' => 'sanitize_text_field'
		) );
		$wp_customize->add_control(
			'health_page_loader_animation_in',
			array(
				'label'    => esc_html__( 'Animation In', 'health' ),
				'section'  => 'health_page_loader_settings',
				'settings' => 'health_page_loader_animation_in',
				'type'     => 'select',
				'choices'  => array(
                    'fade-in' => esc_html__( 'Fade', 'health' ),
                    'fade-in-down-sm' => esc_html__( 'Fade Down', 'health' ),
                    'fade-in-up-sm' => esc_html__( 'Fade Up', 'health' ),
                    'fade-in-left-sm' => esc_html__( 'Fade Left', 'health' ),
                    'fade-in-right-sm' => esc_html__( 'Fade Right', 'health' ),
                    'rotate-in-sm' => esc_html__( 'Rotate', 'health' ),
                    'overlay-slide-in-top' => esc_html__( 'Slide top', 'health' ),
                    'overlay-slide-in-bottom' => esc_html__( 'Slide bottom', 'health' ),
                    'overlay-slide-in-left' => esc_html__( 'Slide left', 'health' ),
                    'overlay-slide-in-right' => esc_html__( 'Slide right', 'health' ),
                    
                    
                    
                    
					
                    
                    
					 
				),
				'priority'   => 110
			)
		);
         
		/**
		 * 
		 *  Animation Out
		 * 
		 */
		
		$wp_customize->add_setting( 'health_page_loader_animation_out' , array(
		    'default'     => 'fade-out',
		    'transport'   => 'refresh',
			'sanitize_callback' => 'sanitize_text_field'
		) );
		$wp_customize->add_control(
			'health_page_loader_animation_out',
			array(
				'label'    => esc_html__( 'Animation Out', 'health' ),
				'section'  => 'health_page_loader_settings',
				'settings' => 'health_page_loader_animation_out',
				'type'     => 'select',
				'choices'  => array(
					'none' => esc_html__( 'None', 'health' ),
                    'fade-out' => esc_html__( 'Fade', 'health' ),
                    'fade-out-down-sm' => esc_html__( 'Fade Down', 'health' ),
                    'fade-out-up-sm' => esc_html__( 'Fade Up', 'health' ),
					'fade-out-left-sm' => esc_html__( 'Fade Left', 'health' ),
                    'fade-out-right-sm' => esc_html__( 'Fade Right', 'health' ),
                    'rotate-out-sm' => esc_html__( 'Rotate', 'health' ),
                    'overlay-slide-out-top' => esc_html__( 'Slide top', 'health' ),
                    'overlay-slide-out-bottom' => esc_html__( 'Slide bottom', 'health' ),
                    'overlay-slide-out-left' => esc_html__( 'Slide left', 'health' ),
                    'overlay-slide-out-right' => esc_html__( 'Slide right', 'health' ),
					 
				),
				'priority'   => 110
			)
		);
		
		/**
		 * 
		 *  Duration In
		 * 
		 */
		
		$wp_customize->add_setting( 'health_page_loader_duration_in' , array(
		    'default'     => '800',
		    'transport'   => 'refresh',
			'sanitize_callback' => 'sanitize_text_field'
		) );
		$wp_customize->add_control(
			'health_page_loader_duration_in',
			array(
				'label'    => esc_html__( 'Duration In', 'health' ),
				'section'  => 'health_page_loader_settings',
				'settings' => 'health_page_loader_duration_in',
				'type' => 'text',
				'priority'   => 110
			)
		);
		
		/**
		 * 
		 *  Duration Out
		 * 
		 */
		
		$wp_customize->add_setting( 'health_page_loader_duration_out' , array(
		    'default'     => '800',
		    'transport'   => 'refresh',
			'sanitize_callback' => 'sanitize_text_field'
		) );
		$wp_customize->add_control(
			'health_page_loader_duration_out',
			array(
				'label'    => esc_html__( 'Duration Out', 'health' ),
				'section'  => 'health_page_loader_settings',
				'settings' => 'health_page_loader_duration_out',
				'type' => 'text',
				'priority'   => 110
			)
		);

		/* Loader color */
		$wp_customize->add_setting( 'health_page_loader_bg_color' , array(
		    'default'     => get_option('health_page_loader_bg_color'),
		    'transport'   => 'refresh',
			'sanitize_callback' => 'esc_attr'
		) );
		$wp_customize->add_control(
			new WP_Customize_Color_Control(
	            $wp_customize,
	            'health_page_loader_bg_color',
				array(
				   'label'      => esc_html__( 'Loader Background', 'health' ),
				   'section'    => 'health_page_loader_settings',
				   'settings'   => 'health_page_loader_bg_color',
				   'priority'   => 110
				)
	       )
		);

	}
	
	