<?php
/**
 * Theme Customizer Controls
 *
 * @package Lawyer Consultant
 */


if ( ! function_exists( 'lawyer_consultant_customizer_home_banner_register' ) ) :
function lawyer_consultant_customizer_home_banner_register( $wp_customize ) {
 	
 	$wp_customize->add_section(
        'lawyer_consultant_home_banner_settings',
        array (
            'priority'      => 25,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Banner Settings', 'lawyer-consultant' )
        )
    );

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

	$wp_customize->add_control( 
		new Lawyer_Consultant_Title_Info_Control( $wp_customize, 'lawyer_consultant_label_banner_settings_title', 
		array(
		    'label'       => esc_html__( 'Banner Settings', 'lawyer-consultant' ),
		    'section'     => 'lawyer_consultant_home_banner_settings',
		    'type'        => 'lawyer-consultant-title',
		    'settings'    => 'lawyer_consultant_label_banner_settings_title',
		) 
	));

    // Button Image
    $wp_customize->add_setting(
        'lawyer_consultant_banner_image',
        array(
            'default'           => '',
            'sanitize_callback' => 'lawyer_consultant_sanitize_image',

        )
    );
    
    $wp_customize->add_control(
        new WP_Customize_Image_Control(
            $wp_customize, 'lawyer_consultant_banner_image', 
            array(
                'label'           => sprintf( esc_html__( 'Banner Image', 'lawyer-consultant' ), ),
                'settings'  => 'lawyer_consultant_banner_image',
                'section'   => 'lawyer_consultant_home_banner_settings'
            ) 
        )
    );

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

    $wp_customize->add_control(
        'lawyer_consultant_banner_heading',
        array(
            'label'           => sprintf( esc_html__( 'Banner Heading', 'lawyer-consultant' ), ),
            'section'         => 'lawyer_consultant_home_banner_settings',
            'settings'        => 'lawyer_consultant_banner_heading' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control(
        'lawyer_consultant_banner_text',
        array(
            'label'           => sprintf( esc_html__( 'Banner Text', 'lawyer-consultant' ), ),
            'section'         => 'lawyer_consultant_home_banner_settings',
            'settings'        => 'lawyer_consultant_banner_text' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control(
        'lawyer_consultant_banner_button_link',
        array(
            'label'           => sprintf( esc_html__( 'Banner Button Link', 'lawyer-consultant' ), ),
            'section'         => 'lawyer_consultant_home_banner_settings',
            'settings'        => 'lawyer_consultant_banner_button_link' ,
            'type'            => 'url',
        )
    );
    
    // Slider Content Alignment Setting
    $wp_customize->add_setting(
        'lawyer_consultant_slider_content_alignment',
        array(
            'default'           => 'left',
            'sanitize_callback' => 'lawyer_consultant_sanitize_select',
        )
    );

    $wp_customize->add_control(
        'lawyer_consultant_slider_content_alignment',
        array(
            'label'    => esc_html__( 'Slider Content Alignment', 'lawyer-consultant' ),
            'section'  => 'lawyer_consultant_home_banner_settings',
            'settings' => 'lawyer_consultant_slider_content_alignment',
            'type'     => 'select',
            'choices'  => array(
                'left'   => esc_html__( 'Left', 'lawyer-consultant' ),
                'center' => esc_html__( 'Center', 'lawyer-consultant' ),
                'right'  => esc_html__( 'Right', 'lawyer-consultant' ),
            ),
        )
    );   
}
endif;

add_action( 'customize_register', 'lawyer_consultant_customizer_home_banner_register' );