<?php
function vegan_cafe_restaurant_sidebar_setting( $wp_customize ) {
$selective_refresh = isset( $wp_customize->selective_refresh ) ? 'postMessage' : 'refresh';
	$wp_customize->add_panel(
		'vegan_cafe_restaurant_sidebar', array(
			'priority' => 31,
			'title' => esc_html__( 'Sidebar Options', 'vegan-cafe-restaurant' ),
		)
	);

	/*=========================================
	Sidebar Option  Section
	=========================================*/
	$wp_customize->add_section(
		'vegan_cafe_restaurant_sidebar_settings', array(
			'title' => esc_html__( 'Sidebar Options', 'vegan-cafe-restaurant' ),
			'priority' => 1,
			'panel' => 'vegan_cafe_restaurant_general',
		)
	);
	

	// Archive Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'vegan_cafe_restaurant_archive_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'vegan_cafe_restaurant_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'vegan_cafe_restaurant_archive_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Archive Sidebar', 'vegan-cafe-restaurant' ),
			'section'     => 'vegan_cafe_restaurant_sidebar_settings',
			'settings'    => 'vegan_cafe_restaurant_archive_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Index Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'vegan_cafe_restaurant_index_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'vegan_cafe_restaurant_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'vegan_cafe_restaurant_index_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Index Sidebar', 'vegan-cafe-restaurant' ),
			'section'     => 'vegan_cafe_restaurant_sidebar_settings',
			'settings'    => 'vegan_cafe_restaurant_index_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Pages Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'vegan_cafe_restaurant_paged_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'vegan_cafe_restaurant_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'vegan_cafe_restaurant_paged_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Pages Sidebar', 'vegan-cafe-restaurant' ),
			'section'     => 'vegan_cafe_restaurant_sidebar_settings',
			'settings'    => 'vegan_cafe_restaurant_paged_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Search Result Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'vegan_cafe_restaurant_search_result_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'vegan_cafe_restaurant_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'vegan_cafe_restaurant_search_result_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Search Result Sidebar', 'vegan-cafe-restaurant' ),
			'section'     => 'vegan_cafe_restaurant_sidebar_settings',
			'settings'    => 'vegan_cafe_restaurant_search_result_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Single Post Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'vegan_cafe_restaurant_single_post_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'vegan_cafe_restaurant_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'vegan_cafe_restaurant_single_post_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Single Post Sidebar', 'vegan-cafe-restaurant' ),
			'section'     => 'vegan_cafe_restaurant_sidebar_settings',
			'settings'    => 'vegan_cafe_restaurant_single_post_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Sidebar Page Sidebar Date Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'vegan_cafe_restaurant_single_page_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'vegan_cafe_restaurant_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'vegan_cafe_restaurant_single_page_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Page Width Sidebar', 'vegan-cafe-restaurant' ),
			'section'     => 'vegan_cafe_restaurant_sidebar_settings',
			'settings'    => 'vegan_cafe_restaurant_single_page_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	$wp_customize->add_setting( 'vegan_cafe_restaurant_sidebar_position', array(
        'default'   => 'right',
        'sanitize_callback' => 'vegan_cafe_restaurant_sanitize_sidebar_position',
    ));

    $wp_customize->add_control( 'vegan_cafe_restaurant_sidebar_position', array(
        'label'    => __( 'Sidebar Position', 'vegan-cafe-restaurant' ),
        'section'  => 'vegan_cafe_restaurant_sidebar_settings',
        'settings' => 'vegan_cafe_restaurant_sidebar_position',
        'type'     => 'radio',
        'choices'  => array(
            'right' => __( 'Right Sidebar', 'vegan-cafe-restaurant' ),
            'left'  => __( 'Left Sidebar', 'vegan-cafe-restaurant' ),
        ),
    ));

	 $wp_customize->add_setting( 'vegan_cafe_restaurant_upgrade_page_settings_15',
        array(
            'sanitize_callback' => 'sanitize_text_field'
        )
    );
    $wp_customize->add_control( new Vegan_Cafe_Restaurant_Control_Upgrade(
        $wp_customize, 'vegan_cafe_restaurant_upgrade_page_settings_15',
            array(
                'priority'      => 200,
                'section'       => 'vegan_cafe_restaurant_sidebar_settings',
                'settings'      => 'vegan_cafe_restaurant_upgrade_page_settings_15',
                'label'         => __( 'Vegan Cafe Restaurant Pro comes with additional features.', 'vegan-cafe-restaurant' ),
                'choices'       => array( __( '15+ Ready-Made Sections', 'vegan-cafe-restaurant' ), __( 'One-Click Demo Import', 'vegan-cafe-restaurant' ), __( 'WooCommerce Integrated', 'vegan-cafe-restaurant' ), __( 'Drag & Drop Section Reordering', 'vegan-cafe-restaurant' ),__( 'Advanced Typography Control', 'vegan-cafe-restaurant' ),__( 'Intuitive Customization Options', 'vegan-cafe-restaurant' ),__( '24/7 Support', 'vegan-cafe-restaurant' ), )
            )
        )
    ); 
}

add_action( 'customize_register', 'vegan_cafe_restaurant_sidebar_setting' );