<?php
/**
 * Theme Customizer Controls
 *
 * @package Legacy Medical Appointment
 */

if ( ! function_exists( 'legacy_medical_appointment_customizer_global_color_setting_register' ) ) :
function legacy_medical_appointment_customizer_global_color_setting_register( $wp_customize ) {
 
 	$wp_customize->add_section(
        'legacy_medical_appointment_global_color_settings',
        array (
            'priority'      => 40,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Global Color Settings', 'legacy-medical-appointment' )
        )
    );

    // Title label
	$wp_customize->add_setting( 
		'legacy_medical_appointment_theme_color_settings', 
		array(
		    'sanitize_callback' => 'legacy_medical_appointment_sanitize_title',
		) 
	);

	$wp_customize->add_control( 
		new Legacy_Medical_Appointment_Title_Info_Control( $wp_customize, 'legacy_medical_appointment_theme_color_settings', 
		array(
		    'label'       => esc_html__( 'Global Color Settings', 'legacy-medical-appointment' ),
		    'section'     => 'legacy_medical_appointment_global_color_settings',
		    'type'        => 'legacy-medical-appointment-title',
		    'settings'    => 'legacy_medical_appointment_theme_color_settings',
		) 
	));

	$wp_customize->add_setting('legacy_medical_appointment_global_color1',
        array(
            'type' => 'theme_mod',
            'default'           => '#35C7DF',
            'sanitize_callback' => 'sanitize_hex_color'
        )
    );

    $wp_customize->add_control(
        new WP_Customize_Color_Control(
            $wp_customize,
            'legacy_medical_appointment_global_color1',
            array(
                'label'      => esc_html__( 'Global Color1', 'legacy-medical-appointment' ),
                'section'    => 'legacy_medical_appointment_global_color_settings',
                'settings'   => 'legacy_medical_appointment_global_color1',
            )
        )
    ); 

    $wp_customize->add_setting('legacy_medical_appointment_global_color2',
        array(
            'type' => 'theme_mod',
            'default'           => '#4A6BA6',
            'sanitize_callback' => 'sanitize_hex_color'
        )
    );

    $wp_customize->add_control(
        new WP_Customize_Color_Control(
            $wp_customize,
            'legacy_medical_appointment_global_color2',
            array(
                'label'      => esc_html__( 'Global Color2', 'legacy-medical-appointment' ),
                'section'    => 'legacy_medical_appointment_global_color_settings',
                'settings'   => 'legacy_medical_appointment_global_color2',
            )
        )
    );   

}
endif;

add_action( 'customize_register', 'legacy_medical_appointment_customizer_global_color_setting_register' );