<?php
/**
 * General Settings Customizer
 *
 * @package wphester
 */
function wphester_general_settings_customizer ( $wp_customize )
{
	        
	$wp_customize->add_panel('wphester_general_settings',
		array(
			'priority' => 112,
			'capability' => 'edit_theme_options',
			'title' => esc_html__('General Settings','wphester' )
		)
	);
	
	// Preloader
	$wp_customize->add_section(
        'preloader_section',
        array(
            'title' =>esc_html__('Preloader','wphester' ),
			'panel'  => 'wphester_general_settings',
			'priority'   => 1,
			
			)
    );

     $wp_customize->add_setting('preloader_enable',
		array(
			'default' => false,
			'sanitize_callback' => 'wphester_sanitize_checkbox'
			)
	);

	$wp_customize->add_control(new WPHester_Toggle_Control( $wp_customize, 'preloader_enable',
		array(
			'label'    => esc_html__( 'Enable/Disable Preloader', 'wphester'  ),
			'section'  => 'preloader_section',
			'type'     => 'toggle',
			'priority' => 1,
		)
	));


// Header  Info
	$wp_customize->add_section(
        'header_info',
        array(
            'title' =>esc_html__('Header Info','wphester' ),
			'panel'  => 'wphester_general_settings',
			'priority'   => 2,
			
			)
    );

	//Menu Header Info First
    $wp_customize->add_setting(
            'menu_header_icon1', array(
        'default' =>  esc_html('fa-map','wphester'),
        'sanitize_callback' => 'sanitize_text_field',
    ));

    $wp_customize->add_control(
            'menu_header_icon1',
            array(
                'type' => 'text',
                'label' => esc_html__('Icon First', 'wphester'),
                'section' => 'header_info',
            )
            );

    $wp_customize->add_setting(
            'menu_header_title1', array(
        'default' => esc_html__('Adipiscing', 'wphester'),
        'sanitize_callback' => 'sanitize_text_field',
    ));

    $wp_customize->add_control(
            'menu_header_title1',
            array(
                'type' => 'text',
                'label' => esc_html__('Title First', 'wphester'),
                'section' => 'header_info'
            )
    );

    $wp_customize->add_setting(
            'menu_header_text1', array(
        'default' => esc_html__('Duis Aute Irure Dolor ', 'wphester'),
        'sanitize_callback' => 'sanitize_text_field',
    ));

    $wp_customize->add_control(
            'menu_header_text1',
            array(
                'type' => 'textarea',
                'label' => esc_html__('Text First', 'wphester'),
                'section' => 'header_info',
            )
    );

    //Menu Header Info Second
    $wp_customize->add_setting(
            'menu_header_icon2', array(
        'default' => esc_html('fa-clock','wphester'),
        'sanitize_callback' => 'sanitize_text_field',

    ));

    $wp_customize->add_control(
            'menu_header_icon2',
            array(
                'type' => 'text',
                'label' => esc_html__('Icon Second', 'wphester'),
                'section' => 'header_info',

            )
        
    );

    $wp_customize->add_setting(
            'menu_header_title2', array(
        'default' => esc_html__('Quasi Architecto', 'wphester'),
        'sanitize_callback' => 'sanitize_text_field',
    ));

    $wp_customize->add_control(
            'menu_header_title2',
            array(
                'type' => 'text',
                'label' => esc_html__('Title Second', 'wphester'),
                'section' => 'header_info',
            )
    );

    $wp_customize->add_setting(
            'menu_header_text2', array(
        'default' => esc_html__('Sunt In Culpa', 'wphester'),
        'sanitize_callback' => 'sanitize_text_field',
    ));

    $wp_customize->add_control(
            'menu_header_text2',
            array(
                'type' => 'textarea',
                'label' => esc_html__('Text Second', 'wphester'),
                'section' => 'header_info',
            )
    );

    //Menu Header Info Third
    $wp_customize->add_setting(
            'menu_header_icon3', array(
        'default' =>  esc_html('fa-phone','wphester'),
        'sanitize_callback' => 'sanitize_text_field',
    ));

    $wp_customize->add_control(
            'menu_header_icon3',
            array(
                'type' => 'text',
                'label' => esc_html__('Icon Third', 'wphester'),
                'section' => 'header_info',
            )
    );

    $wp_customize->add_setting(
            'menu_header_title3', array(
        'default' => esc_html__('Consequat', 'wphester'),
        'sanitize_callback' => 'sanitize_text_field',
    ));

    $wp_customize->add_control(
            'menu_header_title3',
            array(
                'type' => 'text',
                'label' => esc_html__('Title Third', 'wphester'),
                'section' => 'header_info',
            )
    );

    $wp_customize->add_setting(
            'menu_header_text3', array(
        'default' => esc_html__('Proident: 9999999999', 'wphester'),
        'sanitize_callback' => 'sanitize_text_field',
    ));

    $wp_customize->add_control(
            'menu_header_text3',
            array(
                'type' => 'textarea',
                'label' => esc_html__('Text Third', 'wphester'),
                'section' => 'header_info',
            )
        
    );

    $wp_customize->selective_refresh->add_partial('menu_header_title1', array(
	    'selector' => '.head-contact-info .contact-widget.first h4',
	    'settings' => 'menu_header_title1',
	    
	));
	

	//second
	$wp_customize->selective_refresh->add_partial('menu_header_title2', array(
	    'selector' => '.head-contact-info .contact-widget.second h4',
	    'settings' => 'menu_header_title2',
	    
	));
	

	//third
	$wp_customize->selective_refresh->add_partial('menu_header_title3', array(
	    'selector' => '.head-contact-info .contact-widget.third h4',
	    'settings' => 'menu_header_title3',
	    
	));



	// Sticky Header 
	$wp_customize->add_section(
        'sticky_header_section',
        array(
            'title' =>esc_html__('Sticky Header','wphester' ),
			'panel'  => 'wphester_general_settings',
			'priority'   => 1,
			
			)
    );

     $wp_customize->add_setting('sticky_header_enable',
		array(
			'default' => false,
			'sanitize_callback' => 'wphester_sanitize_checkbox'
			)
	);

	$wp_customize->add_control(new WPHester_Toggle_Control( $wp_customize, 'sticky_header_enable',
		array(
			'label'    => esc_html__( 'Enable/Disable Sticky Header', 'wphester'  ),
			'section'  => 'sticky_header_section',
			'type'     => 'toggle',
			'priority' => 1,
		)
	));


	// Scroll to top
	$wp_customize->add_section(
        'scrolltotop_setting_section',
        array(
            'title' =>esc_html__('Scroll to Top','wphester' ),
			'panel'  => 'wphester_general_settings',
			'priority'   => 3,
			
			)
    );
	
    $wp_customize->add_setting('scrolltotop_setting_enable',
		array(
			'default' => true,
			'sanitize_callback' => 'wphester_sanitize_checkbox'
			)
	);

	$wp_customize->add_control(new WPHester_Toggle_Control( $wp_customize, 'scrolltotop_setting_enable',
		array(
			'label'    => esc_html__( 'Enable/Disable Scroll to Top', 'wphester'  ),
			'section'  => 'scrolltotop_setting_section',
			'type'     => 'toggle',
			'priority' => 1,
		)
	));

	// After Menu
	$wp_customize->add_section(
        'after_menu_setting_section',
        array(
            'title' =>esc_html__('After Menu','wphester' ),
			'panel'  => 'wphester_general_settings',
			'priority'   => 3,
			)
    );

	//Dropdown button or html option
	$wp_customize->add_setting(
    'after_menu_multiple_option',
    array(
        'default'           =>  'none',
		'capability'        =>  'edit_theme_options',
		'sanitize_callback' =>  'wphester_sanitize_select',
    ));
	$wp_customize->add_control('after_menu_multiple_option', array(
		'label' => esc_html__('After Menu','wphester' ),
        'section' => 'after_menu_setting_section',
		'setting' => 'after_menu_multiple_option',
		'type'    =>  'select',
		'choices' =>  array(
			'none'		=>	esc_html__('None', 'wphester' ),
			'menu_btn' 	=> esc_html__('Button', 'wphester' ),
			'html' 		=> esc_html__('HTML', 'wphester' ),
			)
	));

	//After Menu Button Text
	$wp_customize->add_setting(
    'after_menu_btn_txt',
    array(
        'default'           =>  '',
		'capability'        =>  'edit_theme_options',
		'sanitize_callback' =>  'wphester_sanitize_text',
    ));
	$wp_customize->add_control('after_menu_btn_txt', array(
		'label' => esc_html__('Button Text','wphester' ),
        'section' => 'after_menu_setting_section',
		'setting' => 'after_menu_btn_txt',
		'type' => 'text',
	));

	//After Menu Button Link
	$wp_customize->add_setting(
    'after_menu_btn_link',
    array(
        'default'           =>  '',
		'capability'        =>  'edit_theme_options',
		'sanitize_callback' =>  'esc_url_raw',
    ));
	$wp_customize->add_control('after_menu_btn_link', array(
		'label' => esc_html__('Button Link','wphester' ),
        'section' => 'after_menu_setting_section',
		'setting' => 'after_menu_btn_link',
		'type' => 'text',
	));

	//Open in new tab
	$wp_customize->add_setting(
    'after_menu_btn_new_tabl',
    array(
        'default'           =>  false,
		'capability'        =>  'edit_theme_options',
		'sanitize_callback' =>  'wphester_sanitize_checkbox',
    ) );
	
	$wp_customize->add_control('after_menu_btn_new_tabl', array(
		'label' => esc_html__('Open link in a new tab','wphester' ),
        'section' => 'after_menu_setting_section',
		'setting' => 'after_menu_btn_new_tabl',
		'type'    =>  'checkbox'
	));	

	//Border Radius
	$wp_customize->add_setting( 'after_menu_btn_border',
			array(
				'default' => 0,
				'transport' => 'postMessage',
				'sanitize_callback' => 'absint'
			)
		);
		$wp_customize->add_control( new WPHester_Slider_Custom_Control( $wp_customize, 'after_menu_btn_border',
			array(
				'label' => esc_html__( 'Button Border Radius', 'wphester'  ),
				'section' => 'after_menu_setting_section',
				'input_attrs' => array(
					'min' => 0,
					'max' => 30,
					'step' => 1,),)
		));

	//After Menu HTML section
	$wp_customize->add_setting('after_menu_html', 
		array(
		'default'=>	'',
			'capability'        =>  'edit_theme_options',
			'sanitize_callback'=> 'wphester_sanitize_text',
		)
	);

	$wp_customize->add_control('after_menu_html', 
		array(
			'label'=> esc_html__('HTML','wphester' ),
			'section'=> 'after_menu_setting_section',
			'type'=> 'textarea',
		)
	);

	//Enable/Disable Search Icon
    $wp_customize->add_setting('search_btn_enable',
		array(
			'default' => false,
			'sanitize_callback' => 'wphester_sanitize_checkbox'
			)
	);

	$wp_customize->add_control(new WPHester_Toggle_Control( $wp_customize, 'search_btn_enable',
		array(
			'label'    => esc_html__( 'Enable/Disable Search Icon', 'wphester'  ),
			'section'  => 'after_menu_setting_section',
			'type'     => 'toggle',
		)
	));

	//Enable/Disable Cart Icon
    $wp_customize->add_setting('cart_btn_enable',
		array(
			'default' => false,
			'sanitize_callback' => 'wphester_sanitize_checkbox'
			)
	);

	$wp_customize->add_control(new WPHester_Toggle_Control( $wp_customize, 'cart_btn_enable',
		array(
			'label'    => esc_html__( 'Enable/Disable Cart Icon', 'wphester'  ),
			'section'  => 'after_menu_setting_section',
			'type'     => 'toggle',
		)
	));	
	//Breadcrumb type setting.
    $wp_customize->add_section(
            'breadcrumb_setting_section',
            array(
                'title' => __('Breadcrumb Settings', 'wphester'),
                'panel' => 'wphester_general_settings',
                'priority' => 5,
            )
    );
	
	//Dropdown button or html option
	$wp_customize->add_setting(
    'wphester_breadcrumb_type',
    array(
        'default'           =>  'yoast',
		'capability'        =>  'edit_theme_options',
		'sanitize_callback' =>  'wphester_sanitize_select',
    ));
	$wp_customize->add_control('wphester_breadcrumb_type', array(
		'label' => esc_html__('Breadcrumb type','wphester'),
		'description' => esc_html__( 'If you use other than "default" one you will need to install and activate respective plugins Breadcrumb','wphester') . ' NavXT, Yoast SEO ' . __('and','wphester') . ' Rank Math SEO',
        'section' => 'breadcrumb_setting_section',
		'setting' => 'wphester_breadcrumb_type',
		'type'    =>  'select',
		'choices' =>  array(
			'default' => __( 'Default(Disable)','wphester'),
            'yoast'  => 'Yoast SEO',
            'rankmath'  => 'Rank Math',
			'navxt'  => 'NavXT',
			)
	));	
	// Container Width
	$wp_customize->add_section(
        'container_width_section',
        array(
            'title' =>esc_html__('Container Width','wphester' ),
			'panel'  => 'wphester_general_settings',
			'priority'   => 5,
			)
    );

    $wp_customize->add_setting( 'container_width',
			array(
				'default' => 1140,
				'transport' => 'postMessage',
				'sanitize_callback' => 'absint'
			)
		);
		$wp_customize->add_control( new WPHester_Slider_Custom_Control( $wp_customize, 'container_width',
			array(
				'label' => esc_html__( 'Container Width', 'wphester'  ),
				'section' => 'container_width_section',
				'input_attrs' => array(
					'min' => 600,
					'max' => 1920,
					'step' => 1,),)
		));

	/******************** Footer Widgets *******************************/
	$wp_customize->add_section(
        'fwidgets_setting_section',
        array(
            'title' =>esc_html__('Footer Widgets','wphester' ),
			'panel'  => 'wphester_general_settings',
			)
    );

	$wp_customize->add_setting( 'footer_widgets_section',
	array(
		'default' => 3,
		'capability'        =>  'edit_theme_options',
		'sanitize_callback' => 'wphester_sanitize_select'
	));
	$wp_customize->add_control( new WPHester_Image_Radio_Button_Custom_Control( $wp_customize, 'footer_widgets_section',
	array(
		'label' => esc_html__( 'Widgets Layout', 'wphester'  ),
		'section' => 'fwidgets_setting_section',
		'choices' => array(
			2 => array( 
				'image' => trailingslashit( get_template_directory_uri() ) . 'assets/images/2-col.png',
			),
			3 => array(
				'image' => trailingslashit( get_template_directory_uri() ) . 'assets/images/3-col.png',
			),
			4 => array(
				'image' => trailingslashit( get_template_directory_uri() ) . 'assets/images/4-col.png',
			)
		)
	)
) );

	}
add_action( 'customize_register', 'wphester_general_settings_customizer' );