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


if ( ! function_exists( 'legacy_medical_appointment_customizer_home_banner_register' ) ) :
function legacy_medical_appointment_customizer_home_banner_register( $wp_customize ) {
 	
 	$wp_customize->add_section(
        'legacy_medical_appointment_home_banner_settings',
        array (
            'priority'      => 25,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Banner Settings', 'legacy-medical-appointment' )
        )
    );

    // Title label
	$wp_customize->add_setting( 
		'legacy_medical_appointment_label_banner_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_banner_settings_title', 
		array(
		    'label'       => esc_html__( 'Banner Settings', 'legacy-medical-appointment' ),
		    'section'     => 'legacy_medical_appointment_home_banner_settings',
		    'type'        => 'legacy-medical-appointment-title',
		    'settings'    => 'legacy_medical_appointment_label_banner_settings_title',
		) 
	));

    // Button Image
    $wp_customize->add_setting(
        'legacy_medical_appointment_banner_image',
        array(
            'default'           => '',
            'sanitize_callback' => 'legacy_medical_appointment_sanitize_image',

        )
    );
    
    $wp_customize->add_control(
        new WP_Customize_Image_Control(
            $wp_customize, 'legacy_medical_appointment_banner_image', 
            array(
                'label'           => sprintf( esc_html__( 'Banner Image', 'legacy-medical-appointment' ), ),
                'settings'  => 'legacy_medical_appointment_banner_image',
                'section'   => 'legacy_medical_appointment_home_banner_settings'
            ) 
        )
    );

    // Banner sm-hd
    $wp_customize->add_setting(
        'legacy_medical_appointment_banner_small_head',
        array(
            'default'           => '',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );

    $wp_customize->add_control(
        'legacy_medical_appointment_banner_small_head',
        array(
            'label'           => sprintf( esc_html__( 'Banner Small Heading', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_banner_settings',
            'settings'        => 'legacy_medical_appointment_banner_small_head' ,
            'type'            => 'text',
        )
    );

    // Banner Heading
	$wp_customize->add_setting(
        'legacy_medical_appointment_banner_heading',
        array(
            'default'           => '',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );

    $wp_customize->add_control(
        'legacy_medical_appointment_banner_heading',
        array(
            'label'           => sprintf( esc_html__( 'Banner Heading', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_banner_settings',
            'settings'        => 'legacy_medical_appointment_banner_heading' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control(
        'legacy_medical_appointment_banner_text',
        array(
            'label'           => sprintf( esc_html__( 'Banner Text', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_banner_settings',
            'settings'        => 'legacy_medical_appointment_banner_text' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control(
        'legacy_medical_appointment_banner_button_link',
        array(
            'label'           => sprintf( esc_html__( 'Banner Button1 Link', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_banner_settings',
            'settings'        => 'legacy_medical_appointment_banner_button_link' ,
            'type'            => 'url',
        )
    );

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

    $wp_customize->add_control(
        'legacy_medical_appointment_banner_button_link2',
        array(
            'label'           => sprintf( esc_html__( 'Banner Button2 Link', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_banner_settings',
            'settings'        => 'legacy_medical_appointment_banner_button_link2' ,
            'type'            => 'url',
        )
    );

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

    $wp_customize->add_control(
        'legacy_medical_appointment_banner_scedule_day',
        array(
            'label'           => sprintf( esc_html__( 'Day', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_banner_settings',
            'settings'        => 'legacy_medical_appointment_banner_scedule_day' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control(
        'legacy_medical_appointment_banner_schedule_time',
        array(
            'label'           => sprintf( esc_html__( 'Time', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_banner_settings',
            'settings'        => 'legacy_medical_appointment_banner_schedule_time' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control(
        'legacy_medical_appointment_banner_offer_head',
        array(
            'label'           => sprintf( esc_html__( 'Offer Heading', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_banner_settings',
            'settings'        => 'legacy_medical_appointment_banner_offer_head' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control(
        'legacy_medical_appointment_banner_offer_text',
        array(
            'label'           => sprintf( esc_html__( 'Offer Text', 'legacy-medical-appointment' ), ),
            'section'         => 'legacy_medical_appointment_home_banner_settings',
            'settings'        => 'legacy_medical_appointment_banner_offer_text' ,
            'type'            => 'text',
        )
    );   

    // Slider Content Alignment Setting
    $wp_customize->add_setting(
        'legacy_medical_appointment_slider_content_alignment',
        array(
            'default'           => 'left',
            'sanitize_callback' => 'legacy_medical_appointment_sanitize_select',
        )
    );

    $wp_customize->add_control(
        'legacy_medical_appointment_slider_content_alignment',
        array(
            'label'    => esc_html__( 'Slider Content Alignment', 'legacy-medical-appointment' ),
            'section'  => 'legacy_medical_appointment_home_banner_settings',
            'settings' => 'legacy_medical_appointment_slider_content_alignment',
            'type'     => 'select',
            'choices'  => array(
                'left'   => esc_html__( 'Left', 'legacy-medical-appointment' ),
                'center' => esc_html__( 'Center', 'legacy-medical-appointment' ),
                'right'  => esc_html__( 'Right', 'legacy-medical-appointment' ),
            ),
        )
    );   
}
endif;

add_action( 'customize_register', 'legacy_medical_appointment_customizer_home_banner_register' );