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


if ( ! function_exists( 'legacy_medical_appointment_customizer_header_register' ) ) :
function legacy_medical_appointment_customizer_header_register( $wp_customize ) {

    $wp_customize->add_section(
        'legacy_medical_appointment_home_header_settings',
        array (
            'priority'      => 25,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Header Settings', 'legacy-medical-appointment' )
        )
    );

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

    $wp_customize->add_control(
        'legacy_medical_appointment_topbar_text',
        array(
            'label'           => sprintf( esc_html__( 'Topbar Text', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_header_settings',
            'settings'        => 'legacy_medical_appointment_topbar_text' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control(
        'legacy_medical_appointment_topbar_email_head',
        array(
            'label'           => sprintf( esc_html__( 'Email Heading', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_header_settings',
            'settings'        => 'legacy_medical_appointment_topbar_email_head' ,
            'type'            => 'text',
        )
    );
    
    $wp_customize->add_setting(
        'legacy_medical_appointment_topbar_email_id',
        array(
            'default'           => '',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );

    $wp_customize->add_control(
        'legacy_medical_appointment_topbar_email_id',
        array(
            'label'           => sprintf( esc_html__( 'Email Id', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_header_settings',
            'settings'        => 'legacy_medical_appointment_topbar_email_id' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control( 
        new Legacy_Medical_Appointment_Title_Info_Control( $wp_customize, 'legacy_medical_appointment_label_header_settings_title', 
        array(
            'label'       => esc_html__( 'Tobar Buttons', 'legacy-medical-appointment' ),
            'section'     => 'legacy_medical_appointment_home_header_settings',
            'type'        => 'legacy-medical-appointment-title',
            'settings'    => 'legacy_medical_appointment_label_header_settings_title',
        ) 
    ));

    $wp_customize->add_setting(
        'legacy_medical_appointment_topbar_career_button_link',
        array(
            'default'           => '',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

    $wp_customize->add_control(
        'legacy_medical_appointment_topbar_career_button_link',
        array(
            'label'           => sprintf( esc_html__( 'Topbar Careers Button Link', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_header_settings',
            'settings'        => 'legacy_medical_appointment_topbar_career_button_link' ,
            'type'            => 'url',
        )
    );

    $wp_customize->add_setting(
        'legacy_medical_appointment_topbar_service_button_link',
        array(
            'default'           => '',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

    $wp_customize->add_control(
        'legacy_medical_appointment_topbar_service_button_link',
        array(
            'label'           => sprintf( esc_html__( 'Services Button Link', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_header_settings',
            'settings'        => 'legacy_medical_appointment_topbar_service_button_link' ,
            'type'            => 'url',
        )
    );

    $wp_customize->add_setting(
        'legacy_medical_appointment_topbar_contact_button_link',
        array(
            'default'           => '',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

    $wp_customize->add_control(
        'legacy_medical_appointment_topbar_contact_button_link',
        array(
            'label'           => sprintf( esc_html__( 'Contact Button Link', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_header_settings',
            'settings'        => 'legacy_medical_appointment_topbar_contact_button_link' ,
            'type'            => 'url',
        )
    );

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

    $wp_customize->add_control( 
        new Legacy_Medical_Appointment_Title_Info_Control( $wp_customize, 'legacy_medical_appointment_label_header_settings_title', 
        array(
            'label'       => esc_html__( 'Header Settings', 'legacy-medical-appointment' ),
            'section'     => 'legacy_medical_appointment_home_header_settings',
            'type'        => 'legacy-medical-appointment-title',
            'settings'    => 'legacy_medical_appointment_label_header_settings_title',
        ) 
    ));

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

    $wp_customize->add_control(
        'legacy_medical_appointment_header_address_head',
        array(
            'label'           => sprintf( esc_html__( 'Location Heading', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_header_settings',
            'settings'        => 'legacy_medical_appointment_header_address_head' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control(
        'legacy_medical_appointment_header_address',
        array(
            'label'           => sprintf( esc_html__( 'Address', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_header_settings',
            'settings'        => 'legacy_medical_appointment_header_address' ,
            'type'            => 'text',
        )
    );
    
    $wp_customize->add_setting(
        'legacy_medical_appointment_header_phone_head',
        array(
            'default'           => '',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );

    $wp_customize->add_control(
        'legacy_medical_appointment_header_phone_head',
        array(
            'label'           => sprintf( esc_html__( 'Calling Details Heading', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_header_settings',
            'settings'        => 'legacy_medical_appointment_header_phone_head' ,
            'type'            => 'text',
        )
    );

    // Phone Number
    $wp_customize->add_setting(
        'legacy_medical_appointment_header_phone_number',
        array(
            'default'           => '',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );

    $wp_customize->add_control(
        'legacy_medical_appointment_header_phone_number',
        array(
            'label'           => sprintf( esc_html__( 'Phone Number', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_header_settings',
            'settings'        => 'legacy_medical_appointment_header_phone_number' ,
            'type'            => 'text',
        )
    );
}
endif;

add_action( 'customize_register', 'legacy_medical_appointment_customizer_header_register' );