<?php
function led_tv_sidebar_setting( $wp_customize ) {
$selective_refresh = isset( $wp_customize->selective_refresh ) ? 'postMessage' : 'refresh';
	$wp_customize->add_panel(
		'led_tv_sidebar', array(
			'priority' => 31,
			'title' => esc_html__( 'Sidebar Options', 'led-tv' ),
		)
	);

	/*=========================================
	Sidebar Option  Section
	=========================================*/
	$wp_customize->add_section(
		'led_tv_sidebar_settings', array(
			'title' => esc_html__( 'Sidebar Options', 'led-tv' ),
			'priority' => 1,
			'panel' => 'led_tv_general',
		)
	);
	

	// Archive Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'led_tv_archive_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'led_tv_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'led_tv_archive_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Archive Sidebar', 'led-tv' ),
			'section'     => 'led_tv_sidebar_settings',
			'settings'    => 'led_tv_archive_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Index Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'led_tv_index_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'led_tv_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'led_tv_index_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Index Sidebar', 'led-tv' ),
			'section'     => 'led_tv_sidebar_settings',
			'settings'    => 'led_tv_index_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Pages Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'led_tv_paged_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'led_tv_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'led_tv_paged_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Pages Sidebar', 'led-tv' ),
			'section'     => 'led_tv_sidebar_settings',
			'settings'    => 'led_tv_paged_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Search Result Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'led_tv_search_result_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'led_tv_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'led_tv_search_result_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Search Result Sidebar', 'led-tv' ),
			'section'     => 'led_tv_sidebar_settings',
			'settings'    => 'led_tv_search_result_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Single Post Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'led_tv_single_post_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'led_tv_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'led_tv_single_post_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Single Post Sidebar', 'led-tv' ),
			'section'     => 'led_tv_sidebar_settings',
			'settings'    => 'led_tv_single_post_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Sidebar Page Sidebar Date Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'led_tv_single_page_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'led_tv_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'led_tv_single_page_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Page Width Sidebar', 'led-tv' ),
			'section'     => 'led_tv_sidebar_settings',
			'settings'    => 'led_tv_single_page_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	$wp_customize->add_setting( 'led_tv_sidebar_position', array(
        'default'   => 'right',
        'sanitize_callback' => 'led_tv_sanitize_sidebar_position',
    ));

    $wp_customize->add_control( 'led_tv_sidebar_position', array(
        'label'    => __( 'Sidebar Position', 'led-tv' ),
        'section'  => 'led_tv_sidebar_settings',
        'settings' => 'led_tv_sidebar_position',
        'type'     => 'radio',
        'choices'  => array(
            'right' => __( 'Right Sidebar', 'led-tv' ),
            'left'  => __( 'Left Sidebar', 'led-tv' ),
        ),
    ));

	 $wp_customize->add_setting( 'led_tv_upgrade_page_settings_15',
        array(
            'sanitize_callback' => 'sanitize_text_field'
        )
    );
    $wp_customize->add_control( new LED_TV_Control_Upgrade(
        $wp_customize, 'led_tv_upgrade_page_settings_15',
            array(
                'priority'      => 200,
                'section'       => 'led_tv_sidebar_settings',
                'settings'      => 'led_tv_upgrade_page_settings_15',
                'label'         => __( 'LED TV Pro comes with additional features.', 'led-tv' ),
                'choices'       => array( __( '15+ Ready-Made Sections', 'led-tv' ), __( 'One-Click Demo Import', 'led-tv' ), __( 'WooCommerce Integrated', 'led-tv' ), __( 'Drag & Drop Section Reordering', 'led-tv' ),__( 'Advanced Typography Control', 'led-tv' ),__( 'Intuitive Customization Options', 'led-tv' ),__( '24/7 Support', 'led-tv' ), )
            )
        )
    ); 
}

add_action( 'customize_register', 'led_tv_sidebar_setting' );