<?php
function mobile_app_launch_sidebar_setting( $wp_customize ) {
$selective_refresh = isset( $wp_customize->selective_refresh ) ? 'postMessage' : 'refresh';
	$wp_customize->add_panel(
		'mobile_app_launch_sidebar', array(
			'priority' => 31,
			'title' => esc_html__( 'Sidebar Options', 'mobile-app-launch' ),
		)
	);

	/*=========================================
	Sidebar Option  Section
	=========================================*/
	$wp_customize->add_section(
		'mobile_app_launch_sidebar_settings', array(
			'title' => esc_html__( 'Sidebar Options', 'mobile-app-launch' ),
			'priority' => 1,
			'panel' => 'mobile_app_launch_general',
		)
	);
	

	// Archive Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'mobile_app_launch_archive_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'mobile_app_launch_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'mobile_app_launch_archive_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Archive Sidebar', 'mobile-app-launch' ),
			'section'     => 'mobile_app_launch_sidebar_settings',
			'settings'    => 'mobile_app_launch_archive_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Index Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'mobile_app_launch_index_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'mobile_app_launch_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'mobile_app_launch_index_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Index Sidebar', 'mobile-app-launch' ),
			'section'     => 'mobile_app_launch_sidebar_settings',
			'settings'    => 'mobile_app_launch_index_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Pages Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'mobile_app_launch_paged_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'mobile_app_launch_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'mobile_app_launch_paged_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Pages Sidebar', 'mobile-app-launch' ),
			'section'     => 'mobile_app_launch_sidebar_settings',
			'settings'    => 'mobile_app_launch_paged_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Search Result Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'mobile_app_launch_search_result_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'mobile_app_launch_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'mobile_app_launch_search_result_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Search Result Sidebar', 'mobile-app-launch' ),
			'section'     => 'mobile_app_launch_sidebar_settings',
			'settings'    => 'mobile_app_launch_search_result_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Single Post Sidebar Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'mobile_app_launch_single_post_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'mobile_app_launch_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'mobile_app_launch_single_post_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Single Post Sidebar', 'mobile-app-launch' ),
			'section'     => 'mobile_app_launch_sidebar_settings',
			'settings'    => 'mobile_app_launch_single_post_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	// Sidebar Page Sidebar Date Hide/ Show Setting // 
	$wp_customize->add_setting( 
		'mobile_app_launch_single_page_sidebar_setting' , 
			array(
			'default' => '1',
			'sanitize_callback' => 'mobile_app_launch_sanitize_checkbox',
			'capability' => 'edit_theme_options',
			'priority' => 2,
		) 
	);
	
	$wp_customize->add_control(
	'mobile_app_launch_single_page_sidebar_setting', 
		array(
			'label'	      => esc_html__( 'Hide / Show Page Width Sidebar', 'mobile-app-launch' ),
			'section'     => 'mobile_app_launch_sidebar_settings',
			'settings'    => 'mobile_app_launch_single_page_sidebar_setting',
			'type'        => 'checkbox'
		) 
	);

	$wp_customize->add_setting( 'mobile_app_launch_sidebar_position', array(
        'default'   => 'right',
        'sanitize_callback' => 'mobile_app_launch_sanitize_sidebar_position',
    ));

    $wp_customize->add_control( 'mobile_app_launch_sidebar_position', array(
        'label'    => __( 'Sidebar Position', 'mobile-app-launch' ),
        'section'  => 'mobile_app_launch_sidebar_settings',
        'settings' => 'mobile_app_launch_sidebar_position',
        'type'     => 'radio',
        'choices'  => array(
            'right' => __( 'Right Sidebar', 'mobile-app-launch' ),
            'left'  => __( 'Left Sidebar', 'mobile-app-launch' ),
        ),
    ));

	 $wp_customize->add_setting( 'mobile_app_launch_upgrade_page_settings_15',
        array(
            'sanitize_callback' => 'sanitize_text_field'
        )
    );
    $wp_customize->add_control( new Mobile_App_Launch_Control_Upgrade(
        $wp_customize, 'mobile_app_launch_upgrade_page_settings_15',
            array(
                'priority'      => 200,
                'section'       => 'mobile_app_launch_sidebar_settings',
                'settings'      => 'mobile_app_launch_upgrade_page_settings_15',
                'label'         => __( 'Mobile App Launch Pro comes with additional features.', 'mobile-app-launch' ),
                'choices'       => array( __( '15+ Ready-Made Sections', 'mobile-app-launch' ), __( 'One-Click Demo Import', 'mobile-app-launch' ), __( 'WooCommerce Integrated', 'mobile-app-launch' ), __( 'Drag & Drop Section Reordering', 'mobile-app-launch' ),__( 'Advanced Typography Control', 'mobile-app-launch' ),__( 'Intuitive Customization Options', 'mobile-app-launch' ),__( '24/7 Support', 'mobile-app-launch' ), )
            )
        )
    ); 
}

add_action( 'customize_register', 'mobile_app_launch_sidebar_setting' );