<?php
/**
 * Theme Customizer Controls
 *
 * @package Corporate Businessmen
 */

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

    $wp_customize->add_section(
        'corporate_businessmen_learning_experiences_settings',
        array (
            'priority'      => 25,
            'capability'    => 'edit_theme_options',
            'title'         => esc_html__( 'Case Experiences Settings', 'corporate-businessmen' )
        )
    );

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

    $wp_customize->add_control( 
        new corporate_businessmen_Title_Info_Control( $wp_customize, 'corporate_businessmen_label_experience_settings_title', 
        array(
            'label'       => esc_html__( 'Case Experience Settings', 'corporate-businessmen' ),
            'section'     => 'corporate_businessmen_learning_experiences_settings',
            'type'        => 'corporate-businessmen-title',
            'settings'    => 'corporate_businessmen_label_experience_settings_title',
        ) 
    ));

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

    $wp_customize->add_control(
        'corporate_businessmen_learning_experiences_small_heading_1',
        array(
            'label'           => sprintf( esc_html__( 'Back Case Heading', 'corporate-businessmen' ), ),
            'section'         => 'corporate_businessmen_learning_experiences_settings',
            'settings'        => 'corporate_businessmen_learning_experiences_small_heading_1' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control(
        'corporate_businessmen_learning_experiences_small_heading',
        array(
            'label'           => sprintf( esc_html__( 'Case Heading', 'corporate-businessmen' ), ),
            'section'         => 'corporate_businessmen_learning_experiences_settings',
            'settings'        => 'corporate_businessmen_learning_experiences_small_heading' ,
            'type'            => 'text',
        )
    );

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

    $wp_customize->add_control(
        'corporate_businessmen_learning_experiences_main_heading',
        array(
            'label'           => sprintf( esc_html__( 'Case Heading Text', 'corporate-businessmen' ), ),
            'section'         => 'corporate_businessmen_learning_experiences_settings',
            'settings'        => 'corporate_businessmen_learning_experiences_main_heading' ,
            'type'            => 'text',
        )
    );
    
    $wp_customize->add_setting( 'corporate_businessmen_learning_experiences_increase', array(
        'default'           => '', 
        'sanitize_callback' => 'corporate_businessmen_sanitize_number',
    ));

    // Add control for number of Services
    $wp_customize->add_control( 'corporate_businessmen_learning_experiences_increase', array(
        'label'       => __( 'Number of Experiences to Display', 'corporate-businessmen' ),
        'section'     => 'corporate_businessmen_learning_experiences_settings', 
        'type'        => 'number', 
        'input_attrs' => array(
            'min' => 1,
            'max' => 10,
        ),      
    ));

    $corporate_businessmen_learning_experiences_count =  get_theme_mod('corporate_businessmen_learning_experiences_increase');

    for($i=1; $i<=$corporate_businessmen_learning_experiences_count; $i++ ) {  

    $wp_customize->add_setting(
        'corporate_businessmen_learning_experiences_image'.$i,
        array(
            'default'           => '',
            'sanitize_callback' => 'corporate_businessmen_sanitize_image',

        )
    );
    
    $wp_customize->add_control(
        new WP_Customize_Image_Control(
            $wp_customize, 'corporate_businessmen_learning_experiences_image'.$i, 
            array(
                'label'           => sprintf( esc_html__( 'Case Image ', 'corporate-businessmen' ).$i, ),
                'settings'  => 'corporate_businessmen_learning_experiences_image'.$i,
                'section'   => 'corporate_businessmen_learning_experiences_settings'
            ) 
        )
    );

    $wp_customize->add_setting(
        'corporate_businessmen_learning_experiences_inner_heading'.$i,
        array(
            'default'           => '',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );

    $wp_customize->add_control(
        'corporate_businessmen_learning_experiences_inner_heading'.$i,
        array(
            'label'           => sprintf( esc_html__( 'Case Name ', 'corporate-businessmen' ).$i, ),
            'section'         => 'corporate_businessmen_learning_experiences_settings',
            'settings'        => 'corporate_businessmen_learning_experiences_inner_heading'.$i ,
            'type'            => 'text',
        )
    );

    $wp_customize->add_setting(
        'corporate_businessmen_learning_experiences_inner_link'.$i,
        array(
            'default'           => '',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );

    $wp_customize->add_control(
        'corporate_businessmen_learning_experiences_inner_link'.$i,
        array(
            'label'           => sprintf( esc_html__( 'Case Name Url ', 'corporate-businessmen' ).$i, ),
            'section'         => 'corporate_businessmen_learning_experiences_settings',
            'settings'        => 'corporate_businessmen_learning_experiences_inner_link'.$i ,
            'type'            => 'url',
        )
    );

    $wp_customize->add_setting(
        'corporate_businessmen_learning_experiences_designation_text'.$i,
        array(
            'default'           => '',
            'sanitize_callback' => 'sanitize_text_field',
        )
    );

    $wp_customize->add_control(
        'corporate_businessmen_learning_experiences_designation_text'.$i,
        array(
            'label'           => sprintf( esc_html__( 'Case Text ', 'corporate-businessmen' ).$i, ),
            'section'         => 'corporate_businessmen_learning_experiences_settings',
            'settings'        => 'corporate_businessmen_learning_experiences_designation_text'.$i ,
            'type'            => 'text',
        )
    );
    }
}
endif;
add_action( 'customize_register', 'corporate_businessmen_customizer_home_about_register' );