<?php
/**
* Services Settings
*
* @package relax_spa
*/


add_action( 'customize_register', 'relax_spa_customize_service_option' );

function relax_spa_customize_service_option( $wp_customize ) {

    $wp_customize->add_section( 'relax_spa_service_section', array(
        'title'         => esc_html__( 'Services Section', 'relax-spa' ),
        'panel'         => 'relax_spa_homepage_panel'
    ) );

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

    $wp_customize->add_control( new Relax_Spa_Toggle_Control( $wp_customize, 'bs_services_show_hide', array(
        'label' => esc_html__( 'Hide / Show Services Blocks','relax-spa' ),
        'section' => 'relax_spa_service_section',
        'settings' => 'bs_services_show_hide',
        'type'=> 'relax-spa-toggle',
    ) ) );

    $wp_customize->add_setting( new Relax_Spa_Repeater_Setting( $wp_customize, 'bs_services_section', array(
        'sanitize_callback' => array( 'Relax_Spa_Repeater_Setting', 'sanitize_repeater_setting' ),
    ) ) );

    $wp_customize->add_control( new Relax_Spa_Control_Repeater( $wp_customize, 'bs_services_section', array(
        'section' => 'relax_spa_service_section',
        'label'			=> __( 'Add Services ', 'relax-spa' ),
        'description'   => __( 'Add Services from here', 'relax-spa' ),
        'row_label' => array(
            'type'  => 'field',
            'value' => esc_html__( 'Service Section', 'relax-spa' ),
            'field' => 'bs_service_title',
        ), 
        'fields'     => array(
            'bs_service_thumbnail'     => array(
                'type'   => 'image',
                'label'  => __( 'Thumbnail', 'relax-spa' ),
            ),
            'bs_service_title'     => array(
                'type'  => 'text',
                'label' => __( 'Title', 'relax-spa' ),
            ),
            'bs_service_desc'     => array(
                'type'  => 'textarea',
                'label' => __( 'Description', 'relax-spa' ),
            ),
            'bs_service_btn'     => array(
                'type'   => 'text',
                'label'  => __( 'Button Label', 'relax-spa' ),
            ),
            'bs_service_btnlink'     => array(
                'type'   => 'url',
                'label'  => __( 'Button Link', 'relax-spa' ),
            ),
        ),                   
    ) ) );
    $wp_customize->selective_refresh->add_partial( 'bs_services_show_hide', array(
        'selector' => '.services > .container',
        
      ) ); 
}