<?php
/**
 * Theme Customizer Controls
 *
 * @package Creamy Bakery
 */

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

    $wp_customize->add_section(
        'creamy_bakery_home_header_settings',
        array (
            'priority'      => 25,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Header Settings', 'creamy-bakery' )
        )
    );

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

    $wp_customize->add_control( 
        new Creamy_Bakery_Title_Info_Control( $wp_customize, 'creamy_bakery_label_header_settings_title', 
        array(
            'label'       => esc_html__( 'Contact Details', 'creamy-bakery' ),
            'section'     => 'creamy_bakery_home_header_settings',
            'type'        => 'creamy-bakery-title',
            'settings'    => 'creamy_bakery_label_header_settings_title',
        ) 
    ));
    
    // Phone Number
    $wp_customize->add_setting(
        'creamy_bakery_topbar_phone_number',
        array(
            'default'           => '',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );

    $wp_customize->add_control(
        'creamy_bakery_topbar_phone_number',
        array(
            'label'           => sprintf( esc_html__( 'Phone Number', 'creamy-bakery' ), ),
            'section'         => 'creamy_bakery_home_header_settings',
            'settings'        => 'creamy_bakery_topbar_phone_number' ,
            'type'            => 'text',
        )
    );

     // Email Id
    $wp_customize->add_setting(
        'creamy_bakery_topbar_email_id',
        array(
            'default'           => '',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );

    $wp_customize->add_control(
        'creamy_bakery_topbar_email_id',
        array(
            'label'           => sprintf( esc_html__( 'Email Id', 'creamy-bakery' ), ),
            'section'         => 'creamy_bakery_home_header_settings',
            'settings'        => 'creamy_bakery_topbar_email_id' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control( 
        new Creamy_Bakery_Title_Info_Control( $wp_customize, 'creamy_bakery_label_social_meida_settings_title', 
        array(
            'label'       => esc_html__( 'Social Media Links', 'creamy-bakery' ),
            'section'     => 'creamy_bakery_home_header_settings',
            'type'        => 'creamy-bakery-title',
            'settings'    => 'creamy_bakery_label_social_meida_settings_title',
        ) 
    ));

    // Facebook Link
    $wp_customize->add_setting(
        'creamy_bakery_social_media1_heading',
        array(
            'default'           => '',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

    $wp_customize->add_control(
        'creamy_bakery_social_media1_heading',
        array(
            'label'           => sprintf( esc_html__( 'Facebook Link', 'creamy-bakery' ), ),
            'section'         => 'creamy_bakery_home_header_settings',
            'settings'        => 'creamy_bakery_social_media1_heading' ,
            'type'            => 'url',
        )
    );

    // Instagram Link
    $wp_customize->add_setting(
        'creamy_bakery_social_media2_heading',
        array(
            'default'           => '',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

    $wp_customize->add_control(
        'creamy_bakery_social_media2_heading',
        array(
            'label'           => sprintf( esc_html__( 'Instagram Link', 'creamy-bakery' ), ),
            'section'         => 'creamy_bakery_home_header_settings',
            'settings'        => 'creamy_bakery_social_media2_heading' ,
            'type'            => 'url',
        )
    );

    // Twitter Link
    $wp_customize->add_setting(
        'creamy_bakery_social_media3_heading',
        array(
            'default'           => '',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

    $wp_customize->add_control(
        'creamy_bakery_social_media3_heading',
        array(
            'label'           => sprintf( esc_html__( 'Twitter Link', 'creamy-bakery' ), ),
            'section'         => 'creamy_bakery_home_header_settings',
            'settings'        => 'creamy_bakery_social_media3_heading' ,
            'type'            => 'url',
        )
    );

    // Youtube Link
    $wp_customize->add_setting(
        'creamy_bakery_social_media4_heading',
        array(
            'default'           => '',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

    $wp_customize->add_control(
        'creamy_bakery_social_media4_heading',
        array(
            'label'           => sprintf( esc_html__( 'Youtube Link', 'creamy-bakery' ), ),
            'section'         => 'creamy_bakery_home_header_settings',
            'settings'        => 'creamy_bakery_social_media4_heading' ,
            'type'            => 'url',
        )
    );

    // Pinterest Link
    $wp_customize->add_setting(
        'creamy_bakery_social_media5_heading',
        array(
            'default'           => '',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

    $wp_customize->add_control(
        'creamy_bakery_social_media5_heading',
        array(
            'label'           => sprintf( esc_html__( 'Pinterest Link', 'creamy-bakery' ), ),
            'section'         => 'creamy_bakery_home_header_settings',
            'settings'        => 'creamy_bakery_social_media5_heading' ,
            'type'            => 'url',
        )
    );

    // Linkedin Link
    $wp_customize->add_setting(
        'creamy_bakery_social_media6_heading',
        array(
            'default'           => '',
            'sanitize_callback' => 'esc_url_raw',
        )
    );

    $wp_customize->add_control(
        'creamy_bakery_social_media6_heading',
        array(
            'label'           => sprintf( esc_html__( 'Linkedin Link', 'creamy-bakery' ), ),
            'section'         => 'creamy_bakery_home_header_settings',
            'settings'        => 'creamy_bakery_social_media6_heading' ,
            'type'            => 'url',
        )
    );

    // topbar buttons
    // Title label
    $wp_customize->add_setting( 
        'creamy_bakery_label_header_settings_title', 
        array(
            'sanitize_callback' => 'creamy_bakery_sanitize_title',
        ) 
    );

    $wp_customize->add_control( 
        new Creamy_Bakery_Title_Info_Control( $wp_customize, 'creamy_bakery_label_header_settings_title', 
        array(
            'label'       => esc_html__( 'Tobar Button', 'creamy-bakery' ),
            'section'     => 'creamy_bakery_home_header_settings',
            'type'        => 'creamy-bakery-title',
            'settings'    => 'creamy_bakery_label_header_settings_title',
        ) 
    ));

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

    $wp_customize->add_control(
        'creamy_bakery_topbar_reserve_button_link',
        array(
            'label'           => sprintf( esc_html__( 'Topbar Reservation Button Link', 'creamy-bakery' ), ),
            'section'         => 'creamy_bakery_home_header_settings',
            'settings'        => 'creamy_bakery_topbar_reserve_button_link' ,
            'type'            => 'url',
        )
    );
    

}
endif;

add_action( 'customize_register', 'creamy_bakery_customizer_header_register' );