<?php
/*** Header Search
 *
 * @package Newsxo
 */

$newsxo_default = newsxo_get_default_theme_options();

// Right Nav Section
Newsxo_Customizer_Control::add_section(
    'right_nav_section',
    array(
        'title' => esc_html__( 'Right Nav', 'newsxo' ), 
        'panel' => 'header_option_panel',
        'priority' => 45,
    )
);

    Newsxo_Customizer_Control::add_field(
        array(
            'type'     => 'hidden', 
            'settings'  => 'header_rightbar_settings',
            'label'     => esc_html__('Right Nav', 'newsxo'),
            'section'  => 'right_nav_section',
            'sanitize_callback' => 'newsxo_sanitize_text',
        )
    );

    // Blog Post Meta
    Newsxo_Customizer_Control::add_field( 
        array(
            'type'     => 'newsxo-sortable', 
            'settings'  => 'newsxo_rightnav_elements',
            'section'  => 'right_nav_section',
            'disable_switch' => array(
            'header-toggle',
                'search',    
                'dark-light',
                'cart',  
                'subscribe'
            ),
            'default'    => $newsxo_default['newsxo_rightnav_elements'], 
            'choices'    => array(
                'header-toggle' => __( 'Header Toggle Icon', 'newsxo' ),
                'search'        => __( 'Search Icon', 'newsxo' ),
                'cart'          => __( 'Shopping Cart', 'newsxo' ),
                'dark-light'    => __( 'Dark/Light Icon', 'newsxo' ),
                'subscribe'     => __( 'Subscribe', 'newsxo' ),
            ),
            // 'sanitize_callback' => 'newsxo_sanitize_alpha_color',
        )
    );
    // Hide/Show Menu Sidebar
    Newsxo_Customizer_Control::add_field( 
        array(
            'type'     => 'toggle', 
            'settings'  => 'newsxo_menu_sidebar',
            'label' => esc_html__('Header Toggle Icon', 'newsxo'),
            'section'  => 'right_nav_section',
            'default' => true,
            'sanitize_callback' => 'newsxo_sanitize_checkbox',
        )
    );
    Newsxo_Customizer_Control::add_field( 
        array(
            'type'     => 'toggle', 
            'settings'  => 'newsxo_menu_search',
            'label' => esc_html__('Search Icon', 'newsxo'),
            'section'  => 'right_nav_section',
            'default' => true,
            'sanitize_callback' => 'newsxo_sanitize_checkbox',
        )
    );
    Newsxo_Customizer_Control::add_field( 
        array(
            'type'     => 'toggle', 
            'settings'  => 'newsxo_lite_dark_switcher',
            'label' => esc_html__('Dark/Light Icon', 'newsxo'),
            'section'  => 'right_nav_section',
            'default' => true,
            'sanitize_callback' => 'newsxo_sanitize_checkbox',
        )
    );
    if( class_exists( 'WooCommerce' ) ) { 
        // Cart Icon Section Heading 
        Newsxo_Customizer_Control::add_field(
            array(
                'type'      => 'hidden', 
                'settings'  => 'shop_cart_btn_heading',
                'label'     => esc_html__('Shopping Cart', 'newsxo'),
                'section'   => 'right_nav_section',
            )
        );
        // Cart Hide/Show
        Newsxo_Customizer_Control::add_field( 
            array(
                'type'     => 'toggle', 
                'settings'  => 'newsxo_cart_enable',
                'label' => esc_html__('Hide/Show', 'newsxo'),
                'section'  => 'right_nav_section',
                'default' => true,
                'sanitize_callback' => 'newsxo_sanitize_checkbox',
            )
        );
    }

    // Subscribe Section Heading 
    Newsxo_Customizer_Control::add_field(
        array(
            'type'      => 'hidden', 
            'settings'  => 'subscriber_btn_settings',
            'label'     => esc_html__('Subscribe', 'newsxo'),
            'section'   => 'right_nav_section',
        )
    );
    // Hide/Show Subscribe
    Newsxo_Customizer_Control::add_field( 
        array(
            'type'     => 'toggle', 
            'settings'  => 'newsxo_menu_subscriber',
            'label' => esc_html__('Hide/Show', 'newsxo'),
            'section'  => 'right_nav_section',
            'default' => true,
            'sanitize_callback' => 'newsxo_sanitize_checkbox',
        )
    );
    // Subscribe Icon Layout
    Newsxo_Customizer_Control::add_field(
        array(
            'type'     => 'radio-image',
            'settings' => 'subsc_icon_layout',
            'label' => esc_html__('Icon', 'newsxo'),
            'section'  => 'right_nav_section',
            'default'  => 'bell',
            'choices'       => array(
                'bell' => get_template_directory_uri() . '/assets/images/subs1.png',
                'play'    => get_template_directory_uri() . '/assets/images/subs3.png', 
            ),
            'active_callback'   => 'newsxo_menu_subscriber_section_status',
            'sanitize_callback' => 'newsxo_sanitize_radio',
        )
    );
    Newsxo_Customizer_Control::add_field( 
        array(
            'type'     => 'text', 
            'settings'  => 'subs_news_title',
            'label' => esc_html__('Title', 'newsxo'),
            'section'  => 'right_nav_section',
            'default' => esc_html__('Subscribe','newsxo'),
            'sanitize_callback' => 'sanitize_text_field',
            'active_callback'   => 'newsxo_menu_subscriber_section_status',
        )
    );
    // Subscribe Link
    Newsxo_Customizer_Control::add_field( 
        array(
            'type'     => 'text', 
            'settings'  => 'newsxo_subsc_link',
            'label' => esc_html__('Link', 'newsxo'),
            'section'  => 'right_nav_section',
            'default' => '#',
            'sanitize_callback' => 'esc_url_raw',
            'active_callback'   => 'newsxo_menu_subscriber_section_status',
        )
    );
    // Subscribe Open in New Tab
    Newsxo_Customizer_Control::add_field( 
        array(
            'type'     => 'toggle', 
            'settings'  => 'subsc_open_in_new',
            'label' => esc_html__('Open link in a new tab', 'newsxo'),
            'section'  => 'right_nav_section',
            'default' => true,
            'sanitize_callback' => 'newsxo_sanitize_checkbox',
            'active_callback'   => 'newsxo_menu_subscriber_section_status',
        )
    );