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

if ( ! function_exists( 'creamy_bakery_customizer_home_banner_register' ) ) :
function creamy_bakery_customizer_home_banner_register( $wp_customize ) {
 	
 	$wp_customize->add_section(
        'creamy_bakery_home_banner_settings',
        array (
            'priority'      => 25,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Banner Settings', 'creamy-bakery' )
        )
    );

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

	$wp_customize->add_control( 
		new Creamy_Bakery_Title_Info_Control( $wp_customize, 'creamy_bakery_label_banner_settings_title', 
		array(
		    'label'       => esc_html__( 'Banner Settings', 'creamy-bakery' ),
		    'section'     => 'creamy_bakery_home_banner_settings',
		    'type'        => 'creamy-bakery-title',
		    'settings'    => 'creamy_bakery_label_banner_settings_title',
		) 
	));

    // Image
    $wp_customize->add_setting(
        'creamy_bakery_banner_image',
        array(
            'default'           => '',
            'sanitize_callback' => 'creamy_bakery_sanitize_image',

        )
    );
    
    $wp_customize->add_control(
        new WP_Customize_Image_Control(
            $wp_customize, 'creamy_bakery_banner_image', 
            array(
                'label'           => sprintf( esc_html__( 'Banner Image', 'creamy-bakery' ), ),
                'settings'  => 'creamy_bakery_banner_image',
                'section'   => 'creamy_bakery_home_banner_settings'
            ) 
        )
    );

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

    $wp_customize->add_control(
        'creamy_bakery_banner_small_head',
        array(
            'label'           => sprintf( esc_html__( 'Banner Small Heading', 'creamy-bakery' ), ),
            'section'         => 'creamy_bakery_home_banner_settings',
            'settings'        => 'creamy_bakery_banner_small_head' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control(
        'creamy_bakery_banner_heading',
        array(
            'label'           => sprintf( esc_html__( 'Banner Heading', 'creamy-bakery' ), ),
            'section'         => 'creamy_bakery_home_banner_settings',
            'settings'        => 'creamy_bakery_banner_heading' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control(
        'creamy_bakery_banner_text',
        array(
            'label'           => sprintf( esc_html__( 'Banner Text', 'creamy-bakery' ), ),
            'section'         => 'creamy_bakery_home_banner_settings',
            'settings'        => 'creamy_bakery_banner_text' ,
            'type'            => 'text',
        )
    ); 

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

    $wp_customize->add_control(
        'creamy_bakery_banner_button_link',
        array(
            'label'           => sprintf( esc_html__( 'Banner Button Link', 'creamy-bakery' ), ),
            'section'         => 'creamy_bakery_home_banner_settings',
            'settings'        => 'creamy_bakery_banner_button_link' ,
            'type'            => 'url',
        )
    ); 

    $wp_customize->add_setting(
        'creamy_bakery_banner_right_image1',
        array(
            'default'           => '',
            'sanitize_callback' => 'creamy_bakery_sanitize_image',

        )
    );
    
    $wp_customize->add_control(
        new WP_Customize_Image_Control(
            $wp_customize, 'creamy_bakery_banner_right_image1', 
            array(
                'label'           => sprintf( esc_html__( 'Banner Right Image1', 'creamy-bakery' ), ),
                'settings'  => 'creamy_bakery_banner_right_image1',
                'section'   => 'creamy_bakery_home_banner_settings'
            ) 
        )
    );

    $wp_customize->add_setting(
        'creamy_bakery_banner_right_image2',
        array(
            'default'           => '',
            'sanitize_callback' => 'creamy_bakery_sanitize_image',

        )
    );
    
    $wp_customize->add_control(
        new WP_Customize_Image_Control(
            $wp_customize, 'creamy_bakery_banner_right_image2', 
            array(
                'label'           => sprintf( esc_html__( 'Banner Right Image2', 'creamy-bakery' ), ),
                'settings'  => 'creamy_bakery_banner_right_image2',
                'section'   => 'creamy_bakery_home_banner_settings'
            ) 
        )
    );

    $wp_customize->add_setting(
        'creamy_bakery_banner_right_image3',
        array(
            'default'           => '',
            'sanitize_callback' => 'creamy_bakery_sanitize_image',

        )
    );
    
    $wp_customize->add_control(
        new WP_Customize_Image_Control(
            $wp_customize, 'creamy_bakery_banner_right_image3', 
            array(
                'label'           => sprintf( esc_html__( 'Banner Right Image3', 'creamy-bakery' ), ),
                'settings'  => 'creamy_bakery_banner_right_image3',
                'section'   => 'creamy_bakery_home_banner_settings'
            ) 
        )
    );

    $wp_customize->add_setting(
        'creamy_bakery_banner_right_image4',
        array(
            'default'           => '',
            'sanitize_callback' => 'creamy_bakery_sanitize_image',

        )
    );
    
    $wp_customize->add_control(
        new WP_Customize_Image_Control(
            $wp_customize, 'creamy_bakery_banner_right_image4', 
            array(
                'label'           => sprintf( esc_html__( 'Banner Right Image4', 'creamy-bakery' ), ),
                'settings'  => 'creamy_bakery_banner_right_image4',
                'section'   => 'creamy_bakery_home_banner_settings'
            ) 
        )
    ); 

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

    $wp_customize->add_control(
        'creamy_bakery_slider_content_alignment',
        array(
            'label'    => esc_html__( 'Slider Content Alignment', 'creamy-bakery' ),
            'section'  => 'creamy_bakery_home_banner_settings',
            'settings' => 'creamy_bakery_slider_content_alignment',
            'type'     => 'select',
            'choices'  => array(
                'left'   => esc_html__( 'Left', 'creamy-bakery' ),
                'center' => esc_html__( 'Center', 'creamy-bakery' ),
                'right'  => esc_html__( 'Right', 'creamy-bakery' ),
            ),
        )
    );
}
endif;

add_action( 'customize_register', 'creamy_bakery_customizer_home_banner_register' );