<?php
/**
 * Header Section Settings
 *
 * @package charitable_funds
 */

// ---------------------------------------- HEADER OPTIONS ----------------------------------------------------

$wp_customize->add_section(
	'charitable_funds_header_options',
	array(
		'panel' => 'charitable_funds_front_page_options',
		'title' => esc_html__( 'Header Options', 'charitable-funds' ),
        'priority' => 1,
	)
);


// Add setting for sticky header
$wp_customize->add_setting(
	'charitable_funds_enable_sticky_header',
	array(
		'sanitize_callback' => 'charitable_funds_sanitize_switch',
		'default'           => false,
	)
);

// Add control for sticky header setting
$wp_customize->add_control(
	new Charitable_Funds_Toggle_Switch_Custom_Control(
		$wp_customize,
		'charitable_funds_enable_sticky_header',
		array(
			'label'   => esc_html__( 'Enable Sticky Header', 'charitable-funds' ),
			'section' => 'charitable_funds_header_options',
		)
	)
);

// Header Section - Button Label.
$wp_customize->add_setting(
	'charitable_funds_topheader_button_text',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'charitable_funds_topheader_button_text',
	array(
		'label'           => esc_html__( 'Button Label 1', 'charitable-funds'  ),
		'section'         => 'charitable_funds_header_options',
		'settings'        => 'charitable_funds_topheader_button_text',
		'type'            => 'text',
	)
);

// Header Section - Button Link.
$wp_customize->add_setting(
	'charitable_funds_topheader_button_url',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'charitable_funds_topheader_button_url',
	array(
		'label'           => esc_html__( 'Button Link 1', 'charitable-funds' ),
		'section'         => 'charitable_funds_header_options',
		'settings'        => 'charitable_funds_topheader_button_url',
		'type'            => 'url',
	)
);

// Header Section - Button Label.
$wp_customize->add_setting(
	'charitable_funds_topheader_button_text_2',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'charitable_funds_topheader_button_text_2',
	array(
		'label'           => esc_html__( 'Button Label 2', 'charitable-funds'  ),
		'section'         => 'charitable_funds_header_options',
		'settings'        => 'charitable_funds_topheader_button_text_2',
		'type'            => 'text',
	)
);

// Header Section - Button Link.
$wp_customize->add_setting(
	'charitable_funds_topheader_button_url_2',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'charitable_funds_topheader_button_url_2',
	array(
		'label'           => esc_html__( 'Button Link 2', 'charitable-funds' ),
		'section'         => 'charitable_funds_header_options',
		'settings'        => 'charitable_funds_topheader_button_url_2',
		'type'            => 'url',
	)
);

// Contact Section - Phone Icon.
$wp_customize->add_setting(
    'charitable_funds_header_phone_icon',
    array(
        'default' => 'fas fa-phone-volume', // Set default icon here
        'sanitize_callback' => 'sanitize_text_field',
        'capability' => 'edit_theme_options',
    )
);

$wp_customize->add_control(new Charitable_Funds_Change_Icon_Control(
    $wp_customize, 
    'charitable_funds_header_phone_icon',
    array(
        'label'    => __('Phone Icon','charitable-funds'),
        'section'  => 'charitable_funds_header_options',
        'iconset'  => 'fa',
    )
));

// Contact Section - Phone Number.
$wp_customize->add_setting(
	'charitable_funds_phone_number',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'charitable_funds_phone_number',
	array(
		'label'           => esc_html__( 'Phone Number', 'charitable-funds' ),
		'section'         => 'charitable_funds_header_options',
		'settings'        => 'charitable_funds_phone_number',
		'type'            => 'text',
	)
);

// Topbar Section - Topbar Mail icon.
$wp_customize->add_setting(
    'charitable_funds_email_icon',
    array(
        'default' => 'fas fa-envelope', // Set default icon here
        'sanitize_callback' => 'sanitize_text_field',
        'capability' => 'edit_theme_options',
    )
);

$wp_customize->add_control(new Charitable_Funds_Change_Icon_Control(
    $wp_customize, 
    'charitable_funds_email_icon',
    array(
        'label'    => __('Topbar Email Icon','charitable-funds'),
        'section'  => 'charitable_funds_header_options',
        'iconset'  => 'fa',
    )
));

// Topbar Section - Topbar Email Label.
$wp_customize->add_setting(
	'charitable_funds_email_topbar_address',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'charitable_funds_email_topbar_address',
	array(
		'label'           => esc_html__( 'Topbar Email', 'charitable-funds'  ),
		'section'         => 'charitable_funds_header_options',
		'settings'        => 'charitable_funds_email_topbar_address',
		'type'            => 'text',
	)
);


// Header Options - Enable Social Icons.
$wp_customize->add_setting(
	'charitable_funds_enable_header_icon_section',
	array(
		'default'           => false,
		'sanitize_callback' => 'charitable_funds_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Charitable_Funds_Toggle_Switch_Custom_Control(
		$wp_customize,
		'charitable_funds_enable_header_icon_section',
		array(
			'label'    => esc_html__( 'Enable Social', 'charitable-funds' ),
			'section'  => 'charitable_funds_header_options',
			'settings' => 'charitable_funds_enable_header_icon_section',
		)
	)
);

// Add setting for Facebook Link
$wp_customize->add_setting(
	'charitable_funds_header_facebook_link',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'charitable_funds_header_facebook_link',
	array(
		'label'           => esc_html__( 'Facebook Link', 'charitable-funds'  ),
		'section'         => 'charitable_funds_header_options',
		'settings'        => 'charitable_funds_header_facebook_link',
		'type'      => 'url'
	)
);

// Add setting for Facebook Icon Changing
$wp_customize->add_setting(
	'charitable_funds_header_facebook_icon',
	array(
        'default' => 'fab fa-facebook-f',
		'sanitize_callback' => 'sanitize_text_field',
		'capability' => 'edit_theme_options',
		
	)
);	

$wp_customize->add_control(new Charitable_Funds_Change_Icon_Control($wp_customize, 
	'charitable_funds_header_facebook_icon',
	array(
	    'label'   		=> __('Facebook Icon','charitable-funds'),
	    'section' 		=> 'charitable_funds_header_options',
		'iconset' => 'fb',
	))  
);

// Add setting for Linkedin Link
$wp_customize->add_setting(
	'charitable_funds_header_linkedin_link',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'charitable_funds_header_linkedin_link',
	array(
		'label'           => esc_html__( 'Linkedin Link', 'charitable-funds'  ),
		'section'         => 'charitable_funds_header_options',
		'settings'        => 'charitable_funds_header_linkedin_link',
		'type'      => 'url'
	)
);

// Add setting for Linkedin Icon Changing
$wp_customize->add_setting(
	'charitable_funds_header_linkedin_icon',
	array(
        'default' => 'fab fa-linkedin-in',
		'sanitize_callback' => 'sanitize_text_field',
		'capability' => 'edit_theme_options',
		
	)
);	

$wp_customize->add_control(new Charitable_Funds_Change_Icon_Control($wp_customize, 
	'charitable_funds_header_linkedin_icon',
	array(
	    'label'   		=> __('Linkedin Icon','charitable-funds'),
	    'section' 		=> 'charitable_funds_header_options',
		'iconset' => 'fb',
	))  
);

// Add setting for Instagram Link
$wp_customize->add_setting(
	'charitable_funds_header_instagram_link',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'charitable_funds_header_instagram_link',
	array(
		'label'           => esc_html__( 'Instagram Link', 'charitable-funds'  ),
		'section'         => 'charitable_funds_header_options',
		'settings'        => 'charitable_funds_header_instagram_link',
		'type'      => 'url'
	)
);

// Add setting for Instagram Icon Changing
$wp_customize->add_setting(
	'charitable_funds_header_instagram_icon',
	array(
        'default' => 'fab fa-instagram',
		'sanitize_callback' => 'sanitize_text_field',
		'capability' => 'edit_theme_options',
		
	)
);	

$wp_customize->add_control(new Charitable_Funds_Change_Icon_Control($wp_customize, 
	'charitable_funds_header_instagram_icon',
	array(
	    'label'   		=> __('Instagram Icon','charitable-funds'),
	    'section' 		=> 'charitable_funds_header_options',
		'iconset' => 'fb',
	))  
);

// Add setting for Twitter Link
$wp_customize->add_setting(
	'charitable_funds_header_twitter_link',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'charitable_funds_header_twitter_link',
	array(
		'label'           => esc_html__( 'Twitter Link', 'charitable-funds'  ),
		'section'         => 'charitable_funds_header_options',
		'settings'        => 'charitable_funds_header_twitter_link',
		'type'      => 'url'
	)
);

// Add setting for Twitter Icon Changing
$wp_customize->add_setting(
	'charitable_funds_header_twitter_icon',
	array(
        'default' => 'fab fa-x-twitter',
		'sanitize_callback' => 'sanitize_text_field',
		'capability' => 'edit_theme_options',
		
	)
);	

$wp_customize->add_control(new Charitable_Funds_Change_Icon_Control($wp_customize, 
	'charitable_funds_header_twitter_icon',
	array(
	    'label'   		=> __('Twitter Icon','charitable-funds'),
	    'section' 		=> 'charitable_funds_header_options',
		'iconset' => 'fb',
	))  
);

// Add Separator Custom Control
$wp_customize->add_setting( 'charitable_funds_menu_separator', array(
	'sanitize_callback' => 'sanitize_text_field',
));

$wp_customize->add_control( new Charitable_Funds_Separator_Custom_Control( $wp_customize, 'charitable_funds_menu_separator', array(
	'label' => __( 'Menu Settings', 'charitable-funds' ),
	'section' => 'charitable_funds_header_options',
	'settings' => 'charitable_funds_menu_separator',
)));

$wp_customize->add_setting( 'charitable_funds_menu_font_size', array(
    'default'           => 12,
    'sanitize_callback' => 'absint',
));

// Add control for site title size
$wp_customize->add_control( 'charitable_funds_menu_font_size', array(
    'type'        => 'number',
    'section'     => 'charitable_funds_header_options',
    'label'       => __( 'Menu Font Size ', 'charitable-funds' ),
    'input_attrs' => array(
        'min'  => 10,
        'max'  => 100,
        'step' => 1,
    ),
));

// Add setting for menu font weight
$wp_customize->add_setting('charitable_funds_menu_font_weight', array(
    'default'           => '400',
    'sanitize_callback' => 'sanitize_text_field',
));

// Add control for menu font weight
$wp_customize->add_control('charitable_funds_menu_font_weight', array(
    'type'     => 'select',
    'section'  => 'charitable_funds_header_options', 
    'label'    => __('Menu Font Weight', 'charitable-funds'),
    'choices'  => array(
		'100' => __('100','charitable-funds'),
		'200' => __('200','charitable-funds'),
		'300' => __('300','charitable-funds'),
		'400' => __('400','charitable-funds'),
		'500' => __('500','charitable-funds'),
		'600' => __('600','charitable-funds'),
		'700' => __('700','charitable-funds'),
		'800' => __('800','charitable-funds'),
		'900' => __('900','charitable-funds'),
    ),
));

$wp_customize->add_setting( 'charitable_funds_menu_text_transform', array(
    'default'           => 'capitalize', // Default value for text transform
    'sanitize_callback' => 'sanitize_text_field',
) );

// Add control for menu text transform
$wp_customize->add_control( 'charitable_funds_menu_text_transform', array(
    'type'     => 'select',
    'section'  => 'charitable_funds_header_options', // Adjust the section as needed
    'label'    => __( 'Menu Text Transform', 'charitable-funds' ),
    'choices'  => array(
        'none'       => __( 'None', 'charitable-funds' ),
        'capitalize' => __( 'Capitalize', 'charitable-funds' ),
        'uppercase'  => __( 'Uppercase', 'charitable-funds' ),
        'lowercase'  => __( 'Lowercase', 'charitable-funds' ),
    ),
) );

// Menu Text Color 
$wp_customize->add_setting(
	'charitable_funds_menu_text_color', 
	array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'charitable_funds_menu_text_color', 
		array(
			'label' => __('Menu Color', 'charitable-funds'),
			'section' => 'charitable_funds_header_options',
		)
	)
);

// Sub Menu Text Color 
$wp_customize->add_setting(
	'charitable_funds_sub_menu_text_color', 
	array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);

$wp_customize->add_control(
	new WP_Customize_Color_Control(
		$wp_customize, 
		'charitable_funds_sub_menu_text_color', 
		array(
			'label' => __('Sub Menu Color', 'charitable-funds'),
			'section' => 'charitable_funds_header_options',
		)
	)
);

// Topbar Padding Setting
$wp_customize->add_setting('charitable_funds_topbar_padding',array(
		'default' => '',
		'sanitize_callback' => 'absint'
	)
);
$wp_customize->add_control('charitable_funds_topbar_padding',array(
		'label' => __('Topbar Padding','charitable-funds'),
		'section' => 'charitable_funds_header_options',
		'type' => 'number',
		'input_attrs' => array(
			'min' => 0,
			'max' => 50,
			'step' => 1
		)
	)
);

$wp_customize->add_setting( 
	'charitable_funds_header_settings_upgraded_features',
	array(
		'sanitize_callback' => 'sanitize_text_field'
	)
);

$wp_customize->add_control(
	'charitable_funds_header_settings_upgraded_features', 
	array(
		'type'=> 'hidden',
		'description' => "
			<div class='customizer-upgraded-features'>
				<i class='fas fa-info-circle'></i>
				<span class='pro-text'>
					Unlock Premium <strong>Features</strong> ?<br>
					<a target='_blank' href='". esc_url(CHARITABLE_FUNDS_PREMIUM_PAGE) ." '>Upgrade Pro</a>
				</div>
			</div>
		",
		'section' => 'charitable_funds_header_options'
	)
);
