<?php
/*** Footer Option Panel
 *
 * @package Newsxo
 */

$newsxo_default = newsxo_get_default_theme_options();

Newsxo_Customizer_Control::add_panel(
	'footer_option_panel',
	array(
        'title' => __('Footer Options', 'newsxo'),
        'priority' => 7,
	)
);
    // Add Section.
    Newsxo_Customizer_Control::add_section(
        'footer_bg_img_section',
        array(
            'title' => __('Background Image', 'newsxo'),
            'priority' => 5,
            'panel' => 'footer_option_panel',
        )
    );
        //Footer Background image
        Newsxo_Customizer_Control::add_field( 
            array(
                'type'     => 'cropped_image', 
                'settings'  => 'newsxo_footer_bg_img',
                'label' => esc_html__('Background Image', 'newsxo'),
                'section'  => 'footer_bg_img_section',
                'transport'  => 'postMessage',
                'default' => $newsxo_default['newsxo_footer_bg_img'], 
                'flex_width' => true,
                'flex_height' => true,
                'width' => 1600,
                'height' => 700,
            )
        );
        //Background Overlay
        Newsxo_Customizer_Control::add_field( 
            array(
                'type'     => 'color-alpha', 
                'settings'  => 'newsxo_footer_overlay_color',
                'label' => esc_html__('Overlay Color', 'newsxo'),
                'section'  => 'footer_bg_img_section',
                'transport'  => 'postMessage', 
                'default' => '',
                'sanitize_callback' => 'newsxo_sanitize_alpha_color',
            )
        );
        //Text Color 
        Newsxo_Customizer_Control::add_field( 
            array(
                'type'     => 'color-alpha', 
                'settings'  => 'newsxo_footer_text_color',
                'label' => esc_html__('Text Color', 'newsxo'),
                'section'  => 'footer_bg_img_section',
                'transport'  => 'postMessage', 
                'default' => '',
                'sanitize_callback' => 'newsxo_sanitize_alpha_color',
            )
        );
    // Add Section.
    Newsxo_Customizer_Control::add_section(
        'footer_top_section',
        array(
            'title' => __('Top Section', 'newsxo'),
            'priority' => 5,
            'panel' => 'footer_option_panel',
        )
    );
        Newsxo_Customizer_Control::add_field(
            array(
                'type'     => 'newsxo-hf-repeater', 
                'settings'  => 'newsxo_footer_top_repeater',
                'label'   => __( 'Elements', 'newsxo' ),
                'section'  => 'footer_top_section',
                'default' => $newsxo_default['newsxo_footer_top_repeater'],
                'sanitize_callback' => 'wp_kses_post',
                'transport' => 'postMessage',
                'fields' => array(
                    'select'   => true,
                    'column'   => true,
                    'position' => true,
                ),
                'select_choices' => array(
                    'wid-area'         => __( 'Widget Area', 'newsxo' ),
                    'foot-logo-title'  => __( 'Site Identity', 'newsxo' ),
                    'foot-social-icon' => __( 'Social Icon', 'newsxo' ),
                    'copyright'        => __( 'Copyright', 'newsxo' ),
                    'foot-menus'       => __( 'Footer Menus', 'newsxo' ),
                    'custom-html'      => __( 'Custom HTML (Pro)', 'newsxo' ),
                    'top-nav'          => __( 'Top Navigation (Pro)', 'newsxo' ),
                    'promotion'        => __( 'Promotion (Pro)', 'newsxo' ),
                    'off-canvas'       => __( 'Off Canvas (Pro)', 'newsxo' ),
                    'pri-menus'        => __( 'Primary Menus (Pro)', 'newsxo' ),
                    
                ),
                'disabled_choices' => array(
                    'custom-html',
                    'top-nav',
                    'promotion',
                    'off-canvas',
                    'pri-menus',
                ),
                'select_label'    => __( 'Choose Element', 'newsxo' ),
                'column_label'    => __( 'Column Width (%)', 'newsxo' ),
                'position_label'  => __( 'Alignment', 'newsxo' ),
                'add_button_text' => __( 'Add Element', 'newsxo' ),
                'edit_button_text' => __( 'Edit Element Settings', 'newsxo' ),

                'element_sections' => array(
                    'wid-area'         =>  'footer_widget_area_section',
                    'foot-logo-title'  =>  'footer_logo_section',
                    'foot-social-icon' =>  'social_icon_options',
                    'copyright'        =>  'footer_copyright',
                ),
                'element_panels' => array(
                    'foot-menus'         =>  'nav_menus',
                ),
            )
        );
                
        // $wp_customize->add_setting( 'newsxo_footer_top_upsell', array(
        //     'sanitize_callback' => 'esc_attr'
        // ) );

        // $wp_customize->add_control( new Newsxo_Pro_Upsell_Control( $wp_customize, 'newsxo_footer_top_upsell', array(
        //     'label'           => __( 'Need more Footer Options?', 'newsxo' ),
        //     'section'         => 'footer_top_section',
        //     'features'        => array(
        //         __( 'Add more Footer Elements', 'newsxo' ),
        //         __( 'Before Footer area', 'newsxo' ),
        //         __( 'Instagram area', 'newsxo' ),
        //         __( 'Section background color', 'newsxo' ),
        //         __( 'And much More ...', 'newsxo' ),
        //     ),
        //     'url_pro'         => 'https://themeansar.com/themes/newsxo-pro/',
        //     'pro_button_text' => __( 'Upgrade to Pro ☆', 'newsxo' )
        // ) ) );

    // Add Section.
    Newsxo_Customizer_Control::add_section(
        'footer_mid_section',
        array(
            'title' => __('Middle Section', 'newsxo'),
            'priority' => 10,
            'panel' => 'footer_option_panel',
        )
    );
      Newsxo_Customizer_Control::add_field(
            array(
                'type'     => 'newsxo-hf-repeater', 
                'settings'  => 'newsxo_footer_mid_repeater',
                'label'   => __( 'Elements', 'newsxo' ),
                'section'  => 'footer_mid_section',
                'default' => $newsxo_default['newsxo_footer_mid_repeater'],
                'sanitize_callback' => 'wp_kses_post',
                'transport' => 'postMessage',
                'fields' => array(
                    'select'   => true,
                    'column'   => true,
                    'position' => true,
                ),
                'select_choices' => array(
                    'wid-area'         => __( 'Widget Area', 'newsxo' ),
                    'foot-logo-title'  => __( 'Site Identity', 'newsxo' ),
                    'foot-social-icon' => __( 'Social Icon', 'newsxo' ),
                    'copyright'        => __( 'Copyright', 'newsxo' ),
                    'foot-menus'       => __( 'Footer Menus', 'newsxo' ),
                    'custom-html'      => __( 'Custom HTML (Pro)', 'newsxo' ),
                    'top-nav'          => __( 'Top Navigation (Pro)', 'newsxo' ),
                    'promotion'        => __( 'Promotion (Pro)', 'newsxo' ),
                    'off-canvas'       => __( 'Off Canvas (Pro)', 'newsxo' ),
                    'pri-menus'        => __( 'Primary Menus (Pro)', 'newsxo' ),
                    
                ),
                'disabled_choices' => array(
                    'custom-html',
                    'top-nav',
                    'promotion',
                    'off-canvas',
                    'pri-menus',
                ),
                'select_label'    => __( 'Choose Element', 'newsxo' ),
                'column_label'    => __( 'Column Width (%)', 'newsxo' ),
                'position_label'  => __( 'Alignment', 'newsxo' ),
                'add_button_text' => __( 'Add Element', 'newsxo' ),
                'edit_button_text' => __( 'Edit Element Settings', 'newsxo' ),

                'element_sections' => array(
                    'wid-area'         =>  'footer_widget_area_section',
                    'foot-logo-title'  =>  'footer_logo_section',
                    'foot-social-icon' =>  'social_icon_options',
                    'copyright'        =>  'footer_copyright',
                ),
                'element_panels' => array(
                    'foot-menus'         =>  'nav_menus',
                ),
            )
        );
              
        // $wp_customize->add_setting( 'newsxo_footer_mid_upsell', array(
        //     'sanitize_callback' => 'esc_attr'
        // ) );
        // $wp_customize->add_control( new Newsxo_Pro_Upsell_Control( $wp_customize, 'newsxo_footer_mid_upsell', array(
        //     'label'           => __( 'Need more Footer Options?', 'newsxo' ),
        //     'section'         => 'footer_mid_section',
        //     'features'        => array(
        //         __( 'Add more Footer Elements', 'newsxo' ),
        //         __( 'Before Footer area', 'newsxo' ),
        //         __( 'Instagram area', 'newsxo' ),
        //         __( 'Section background color', 'newsxo' ),
        //         __( 'And much More ...', 'newsxo' ),
        //     ),
        //     'url_pro'         => 'https://themeansar.com/themes/newsxo-pro/',
        //     'pro_button_text' => __( 'Upgrade to Pro ☆', 'newsxo' )
        // ) ) );
    
    // Add Section.
    Newsxo_Customizer_Control::add_section(
        'footer_bottom_section',
        array(
            'title' => __('Bottom Section', 'newsxo'),
            'priority' => 15,
            'panel' => 'footer_option_panel',
        )
    );
      Newsxo_Customizer_Control::add_field(
            array(
                'type'     => 'newsxo-hf-repeater', 
                'settings'  => 'newsxo_footer_bottom_repeater',
                'label'   => __( 'Elements', 'newsxo' ),
                'section'  => 'footer_bottom_section',
                'default' => $newsxo_default['newsxo_footer_bottom_repeater'],
                'sanitize_callback' => 'wp_kses_post',
                'transport' => 'postMessage',
                'fields' => array(
                    'select'   => true,
                    'column'   => true,
                    'position' => true,
                ),
                'select_choices' => array(
                    'wid-area'         => __( 'Widget Area', 'newsxo' ),
                    'foot-logo-title'  => __( 'Site Identity', 'newsxo' ),
                    'foot-social-icon' => __( 'Social Icon', 'newsxo' ),
                    'copyright'        => __( 'Copyright', 'newsxo' ),
                    'foot-menus'       => __( 'Footer Menus', 'newsxo' ),
                    'custom-html'      => __( 'Custom HTML (Pro)', 'newsxo' ),
                    'top-nav'          => __( 'Top Navigation (Pro)', 'newsxo' ),
                    'promotion'        => __( 'Promotion (Pro)', 'newsxo' ),
                    'off-canvas'       => __( 'Off Canvas (Pro)', 'newsxo' ),
                    'pri-menus'        => __( 'Primary Menus (Pro)', 'newsxo' ),
                    
                ),
                'disabled_choices' => array(
                    'custom-html',
                    'top-nav',
                    'promotion',
                    'off-canvas',
                    'pri-menus',
                ),
                'select_label'    => __( 'Choose Element', 'newsxo' ),
                'column_label'    => __( 'Column Width (%)', 'newsxo' ),
                'position_label'  => __( 'Alignment', 'newsxo' ),
                'add_button_text' => __( 'Add Element', 'newsxo' ),
                'edit_button_text' => __( 'Edit Element Settings', 'newsxo' ),

                'element_sections' => array(
                    'wid-area'         =>  'footer_widget_area_section',
                    'foot-logo-title'  =>  'footer_logo_section',
                    'foot-social-icon' =>  'social_icon_options',
                    'copyright'        =>  'footer_copyright',
                ),
                'element_panels' => array(
                    'foot-menus'         =>  'nav_menus',
                ),
            )
        );
                      
        // $wp_customize->add_setting( 'newsxo_footer_bottom_upsell', array(
        //     'sanitize_callback' => 'esc_attr'
        // ) );
        // $wp_customize->add_control( new Newsxo_Pro_Upsell_Control( $wp_customize, 'newsxo_footer_bottom_upsell', array(
        //     'label'           => __( 'Need more Footer Options?', 'newsxo' ),
        //     'section'         => 'footer_bottom_section',
        //     'features'        => array(
        //         __( 'Add more Footer Elements', 'newsxo' ),
        //         __( 'Before Footer area', 'newsxo' ),
        //         __( 'Instagram area', 'newsxo' ),
        //         __( 'Section background color', 'newsxo' ),
        //         __( 'And much More ...', 'newsxo' ),
        //     ),
        //     'url_pro'         => 'https://themeansar.com/themes/newsxo-pro/',
        //     'pro_button_text' => __( 'Upgrade to Pro ☆', 'newsxo' )
        // ) ) );
    // Add Section.
    Newsxo_Customizer_Control::add_section(
        'footer_element_heading',
        array(
            'title' => __('Footer Element', 'newsxo'),
            'priority' => 25,
            'panel' => 'footer_option_panel',
        )
    );