<?php
/**
 * Banner Settings
 *
 * @package relax_spa
 */
add_action( 'customize_register', 'relax_spa_customize_banner_section' );

function relax_spa_customize_banner_section( $wp_customize ) {

    $wp_customize->get_section( 'header_image' )->panel = "relax_spa_homepage_panel";
    $wp_customize->get_section( 'header_image' )->title = esc_html__( "Banner Section", 'relax-spa' );

    $wp_customize->add_setting( 'banner_section_display_option', array(
        'sanitize_callback'     =>  'relax_spa_sanitize_checkbox',
        'default'               =>  true
    ) );

    $wp_customize->add_control( new Relax_Spa_Toggle_Control( $wp_customize, 'banner_section_display_option', array(
        'label' => esc_html__( 'Hide / Show','relax-spa' ),
        'section' => 'header_image',
        'settings' => 'banner_section_display_option',
        'type'=> 'relax-spa-toggle',
        'priority'  =>  1
    ) ) );


    $wp_customize->add_setting( 'banner_section_top_title', array(
        'transport' => 'postMessage',
        'sanitize_callback'     =>  'sanitize_text_field',
        'default'               =>  ''
    ) );

    $wp_customize->add_control( 'banner_section_top_title', array(
        'label' => esc_html__( 'Banner Top Title','relax-spa' ),
        'section' => 'header_image',
        'type'=> 'text',
        'priority'  =>  2
    ) ); 

    $wp_customize->selective_refresh->add_partial( 'banner_section_top_title', array(
	    'selector' => '.banner .banner-holder .sub-title',
        'render_callback' => 'relax_spa_get_banner_sec_top_title'
	) );

    $wp_customize->add_setting( 'banner_section_title', array(
        'transport' => 'postMessage',
        'sanitize_callback'     =>  'sanitize_text_field',
        'default'               =>  ''
    ) );
    
    $wp_customize->add_control( 'banner_section_title', array(
        'label' => esc_html__( 'Banner Main Title','relax-spa' ),
        'section' => 'header_image',
        'type'=> 'text',
        'priority'  =>  3
    ) );

    $wp_customize->selective_refresh->add_partial( 'banner_section_title', array(
	    'selector' => '.banner .banner-holder .main-title',
        'render_callback' => 'relax_spa_get_banner_sec_title',
	) );

    $wp_customize->add_setting( 'banner_section_description', array(
        'transport' => 'postMessage',
        'sanitize_callback'     =>  'sanitize_text_field',
        'default'               =>  ''
    ) );

    $wp_customize->add_control( 'banner_section_description', array(
        'label' => esc_html__( 'Description','relax-spa' ),
        'section' => 'header_image',
        'settings' => 'banner_section_description',
        'type'=> 'textarea',
        'priority'  =>  4
    ) );

    $wp_customize->selective_refresh->add_partial( 'banner_section_description', array(
	    'selector' => '.banner-holder p',
        'render_callback' => 'relax_spa_get_banner_desc'
	) );

    $wp_customize->add_setting( 'banner_section_cta_label', array(
        'transport' => 'postMessage',
        'sanitize_callback'     =>  'sanitize_text_field',
        'default'               =>  ''
    ) );

    $wp_customize->add_control( 'banner_section_cta_label', array(
        'label' => esc_html__( 'CTA Label','relax-spa' ),
        'section' => 'header_image',
        'settings' => 'banner_section_cta_label',
        'type'=> 'text',
        'priority'  =>  5
    ) );

    $wp_customize->selective_refresh->add_partial( 'banner_section_cta_label', array(
	    'selector' => '.banner-holder .btn',
        'render_callback' => 'relax_spa_get_banner_cta'
	) );

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

    $wp_customize->add_control( 'banner_section_cta_link', array(
        'label' => esc_html__( 'CTA Link','relax-spa' ),
        'section' => 'header_image',
        'settings' => 'banner_section_cta_link',
        'type'=> 'url',
        'priority'  =>  6
    ) );

    $wp_customize->add_setting( 'bs_bg_image', array(
        'sanitize_callback'     =>  'relax_spa_sanitize_image',
    ) );

    $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'bs_bg_image', array(
        'label'      => esc_html__( 'Background Image', 'relax-spa' ),
        'section'    => 'header_image',
    ) ) );

}