<?php
/**
 * Menu options
 *
 * @package Theme Palace
 * @subpackage Raise Charity Pro
 * @since Raise Charity Pro 1.0.0
 */

// Add sidebar section
$wp_customize->add_section( 'raise_charity_pro_menu', array(
	'title'             => esc_html__('Header Menu','raise-charity-pro'),
	'description'       => esc_html__( 'Header Menu options.', 'raise-charity-pro' ),
	'panel'             => 'nav_menus',
) );

// Menu sticky setting and control.
$wp_customize->add_setting( 'raise_charity_pro_theme_options[menu_sticky]', array(
	'sanitize_callback' => 'raise_charity_pro_sanitize_switch_control',
	'default'           => $options['menu_sticky'],
) );

$wp_customize->add_control( new Raise_Charity_Pro_Switch_Control( $wp_customize, 'raise_charity_pro_theme_options[menu_sticky]', array(
	'label'             => esc_html__( 'Make Menu Sticky', 'raise-charity-pro' ),
	'section'           => 'raise_charity_pro_menu',
	'on_off_label' 		=> raise_charity_pro_switch_options(),
) ) );

$wp_customize->add_setting( 'raise_charity_pro_theme_options[search_icon]', array(
	'sanitize_callback' => 'raise_charity_pro_sanitize_switch_control',
	'default'           => $options['search_icon'],
) );

$wp_customize->add_control( new Raise_Charity_Pro_Switch_Control( $wp_customize, 'raise_charity_pro_theme_options[search_icon]', array(
	'label'             => esc_html__( 'Enable Search', 'raise-charity-pro' ),
	'section'           => 'raise_charity_pro_menu',
	'on_off_label' 		=> raise_charity_pro_switch_options(),
) ) );

// button enable setting and control.
$wp_customize->add_setting( 'raise_charity_pro_theme_options[nav_btn]', array(
	'sanitize_callback' => 'raise_charity_pro_sanitize_switch_control',
	'default'           => $options['nav_btn'],
) );

$wp_customize->add_control( new Raise_Charity_Pro_Switch_Control( $wp_customize, 'raise_charity_pro_theme_options[nav_btn]', array(
	'label'             => esc_html__( 'Enable Button', 'raise-charity-pro' ),
	'section'           => 'raise_charity_pro_menu',
	'on_off_label' 		=> raise_charity_pro_switch_options(),
) ) );

// button text setting and control
$wp_customize->add_setting( 'raise_charity_pro_theme_options[nav_btn_txt]', array(
	'sanitize_callback' => 'sanitize_text_field',
	'default'			=> $options['nav_btn_txt'],
	'transport'			=> 'postMessage',
) );

$wp_customize->add_control( 'raise_charity_pro_theme_options[nav_btn_txt]', array(
	'label'           	=> esc_html__( 'Button Label', 'raise-charity-pro' ),
	'active_callback' 	=> 'raise_charity_pro_is_nav_btn_enable',
	'section'        	=> 'raise_charity_pro_menu',
) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'raise_charity_pro_theme_options[nav_btn_txt]', array(
		'selector'            => '#site-menu li.custom-menu-item a',
		'settings'            => 'raise_charity_pro_theme_options[nav_btn_txt]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'raise_charity_pro_nav_btn_txt_partial',
    ) );
}

// button url setting and control
$wp_customize->add_setting( 'raise_charity_pro_theme_options[nav_btn_url]', array(
	'sanitize_callback' => 'esc_url_raw',
	'default'			=> $options['nav_btn_url'],
) );

$wp_customize->add_control( 'raise_charity_pro_theme_options[nav_btn_url]', array(
	'label'           	=> esc_html__( 'Button URL', 'raise-charity-pro' ),
	'section'        	=> 'raise_charity_pro_menu',
	'active_callback' 	=> 'raise_charity_pro_is_nav_btn_enable',
	'type'				=> 'url'
) );