<?php 
/**
 * Home Section
 *
 * @package prime-fitness-gym
 */
$prime_fitness_gym_default = prime_fitness_gym_get_default_theme_options();

/** Slider Info section */
$wp_customize->add_section(
    'featured_slider_info_section',
    array(
        'title'    => __( 'Slider Info', 'prime-fitness-gym' ),      
        'priority' => 1,
        'panel'      => 'prime_fitness_gym_section_panel',       	
    )
);

// Enable Section
$wp_customize->add_setting(
    'slider_enable_section',
    array(
        'default' 			=> true,
       'sanitize_callback' => 'prime_fitness_gym_sanitize_switch',

    )
);
$wp_customize->add_control(
    new prime_fitness_gym_Toggle_Checkbox_Custom_control(
        $wp_customize,
        'slider_enable_section',
        array(
            'settings'      => 'slider_enable_section',
            'section'       => 'featured_slider_info_section',
            'label'         => __( 'Enable Section', 'prime-fitness-gym' ),
            'on_off_label'  => array(
                'on' => __( 'Yes', 'prime-fitness-gym' ),
                'off' => __( 'No', 'prime-fitness-gym' )
            ),
        )
    )
);

// /// effects
$wp_customize->add_setting('prime_fitness_gym_featured_slider_onload_effects',array(
    'default' => 'Bounce In Up',
    'sanitize_callback' => 'prime_fitness_gym_sanitize_choices',
));
$wp_customize->add_control('prime_fitness_gym_featured_slider_onload_effects',array(
    'type' => 'select',
    'label' => __('Box Onload Transition Effects','prime-fitness-gym'),
    'choices' => array (
        'wow bounceInLeft' => __('Bounce In Left','prime-fitness-gym'),
        'wow bounceInRight' => __('Bounce In Right','prime-fitness-gym'),
        'wow bounceInUp' => __('Bounce In Up','prime-fitness-gym'),
        'wow bounceInDown' => __('Bounce In Down','prime-fitness-gym'),
        'wow zoomIn' => __('Zoom In','prime-fitness-gym'),
        'wow zoomOut' => __('Zoom Out','prime-fitness-gym'),
        'wow fadeInDown' => __('Fade In Down','prime-fitness-gym'),            
        'wow fadeInUp' => __('Fade In Up','prime-fitness-gym'),
        'wow fadeInLeft' => __('Fade In Left','prime-fitness-gym'),
        'wow fadeInRight' => __('Fade In Right','prime-fitness-gym'),
        'flip-up' => __('Flip Up','prime-fitness-gym')
    ),
    'section' => 'featured_slider_info_section',
)); 

// Items
// Number of Slider Items
$wp_customize->add_setting('number_of_featured_slider_items', array(
    'default'           => 3, // Set default number of items
    'sanitize_callback' => 'absint', // Ensure it's a valid integer
));

$wp_customize->add_control('number_of_featured_slider_items', array(
    'label'    => __('Number Of Slider To Show', 'prime-fitness-gym'),
    'section'  => 'featured_slider_info_section', // The section where this control will appear
    'type'     => 'number',
    'input_attrs' => array(
        'min' => 1, // Minimum value
        'max' => 10, // Maximum value
        'step' => 1, // Increment step
    ),
));

$prime_fitness_gym_slider_list = array();
$prime_fitness_gym_args = array('post_type' => 'post'); // Fetch posts, not pages
$prime_fitness_gym_posts = get_posts( $prime_fitness_gym_args ); 
foreach($prime_fitness_gym_posts as $prime_fitness_gym_post) {
    $prime_fitness_gym_slider_list[$prime_fitness_gym_post->ID] = $prime_fitness_gym_post->post_title; // Use post ID as key and title as value
}

for ( $prime_fitness_gym_count = 1; $prime_fitness_gym_count <= 4; $prime_fitness_gym_count++ ) {
    $wp_customize->add_setting( 'select_post_slider' . $prime_fitness_gym_count, array(
        'default'           => '',
        'sanitize_callback' => 'prime_fitness_gym_sanitize_post_dropdown'
    ));
    $wp_customize->add_control( 'select_post_slider' . $prime_fitness_gym_count, array(
        'label'   => __( 'Select A Post Page', 'prime-fitness-gym' ),
        'section' => 'featured_slider_info_section',
        'type'    => 'select', // Use 'select' for custom post list
        'choices' => $prime_fitness_gym_slider_list // Populate choices with posts
    ));
}

// Icons Color and name
// ////////// Facebook Icon
$wp_customize->add_setting('prime_fitness_gym_facebook_icon', array(
    'default'   => 'fa-facebook-f',
    'sanitize_callback' => 'prime_fitness_gym_sanitise_custom_text',
));
$wp_customize->add_control(new prime_fitness_gym_Custom_Text_Control($wp_customize, 'prime_fitness_gym_facebook_icon', array(
    'label'      => esc_html__('Facebook Icon', 'prime-fitness-gym'),
    'section'    => 'featured_slider_info_section',
    'settings'   => 'prime_fitness_gym_facebook_icon',
    'type' => 'text',
))); 

// ////////// Instagram Icon
$wp_customize->add_setting('prime_fitness_gym_instagram_icon', array(
    'default'   => 'fa-instagram',
    'sanitize_callback' => 'prime_fitness_gym_sanitise_custom_text',
));
$wp_customize->add_control(new prime_fitness_gym_Custom_Text_Control($wp_customize, 'prime_fitness_gym_instagram_icon', array(
    'label'      => esc_html__('Instagram Icon', 'prime-fitness-gym'),
    'section'    => 'featured_slider_info_section',
    'settings'   => 'prime_fitness_gym_instagram_icon',
    'type' => 'text',
))); 

// ////////// Twitter Icon
$wp_customize->add_setting('prime_fitness_gym_twitter_icon', array(
    'default'   => 'fa-x-twitter',
    'sanitize_callback' => 'prime_fitness_gym_sanitise_custom_text',
));
$wp_customize->add_control(new prime_fitness_gym_Custom_Text_Control($wp_customize, 'prime_fitness_gym_twitter_icon', array(
    'label'      => esc_html__('Twitter Icon', 'prime-fitness-gym'),
    'section'    => 'featured_slider_info_section',
    'settings'   => 'prime_fitness_gym_twitter_icon',
    'type' => 'text',
))); 

// ////////// Youtube Icon
$wp_customize->add_setting('prime_fitness_gym_youtube_icon', array(
    'default'   => 'fa-youtube',
    'sanitize_callback' => 'prime_fitness_gym_sanitise_custom_text',
));
$wp_customize->add_control(new prime_fitness_gym_Custom_Text_Control($wp_customize, 'prime_fitness_gym_youtube_icon', array(
    'label'      => esc_html__('Youtube Icon', 'prime-fitness-gym'),
    'section'    => 'featured_slider_info_section',
    'settings'   => 'prime_fitness_gym_youtube_icon',
    'type' => 'text',
))); 

// ///////// Social Icon Color
$wp_customize->add_setting('social_icon_color', array(
    'default'   => '#ffffff',
    'transport' => 'refresh',
    'sanitize_callback' => 'sanitize_hex_color',
    ));
  
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'social_icon_color', array(
    'section' => 'featured_slider_info_section',
    'description' => __('Social Icons Color', 'prime-fitness-gym'),
    )));

    ////////// Button

$wp_customize->add_setting('prime_fitness_gym_button1_text', 
    array(
    'default'           => __('PROJECTS', 'prime-fitness-gym'),
    'type'              => 'theme_mod',
    'capability'        => 'edit_theme_options',    
    'sanitize_callback' => 'sanitize_text_field'
    )
);

$wp_customize->add_control('prime_fitness_gym_button1_text', 
    array(
    'label'       => __('Projects Button Text', 'prime-fitness-gym'),
    'section'     => 'featured_slider_info_section',   
    'settings'    => 'prime_fitness_gym_button1_text',           
    'type'        => 'text'
    )
);

$wp_customize->add_setting('slider_buttonbg1_color', array(
    'default'   => '#fff',
    'transport' => 'refresh',
    'sanitize_callback' => 'sanitize_hex_color',
));
          
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'slider_buttonbg1_color', array(
    'section' => 'featured_slider_info_section',
    'description' => __('Project Background Color', 'prime-fitness-gym'),
)));


$wp_customize->add_setting('slider_buttontext1_color', array(
    'default'   => '#0d0e10',
    'transport' => 'refresh',
    'sanitize_callback' => 'sanitize_hex_color',
));
          
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'slider_buttontext1_color', array(
    'section' => 'featured_slider_info_section',
    'description' => __('Project Button Text Color', 'prime-fitness-gym'),
)));

$wp_customize->add_setting('slider_button_icon_bg_color', array(
    'default'   => '#c2fc85',
    'transport' => 'refresh',
    'sanitize_callback' => 'sanitize_hex_color',
));
          
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'slider_button_icon_bg_color', array(
    'section' => 'featured_slider_info_section',
    'description' => __('Project Button Icon Background Color', 'prime-fitness-gym'),
)));

$wp_customize->add_setting('slider_button_icon_color', array(
    'default'   => '#000',
    'transport' => 'refresh',
    'sanitize_callback' => 'sanitize_hex_color',
));
          
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'slider_button_icon_color', array(
    'section' => 'featured_slider_info_section',
    'description' => __('Project Button Icon Color', 'prime-fitness-gym'),
)));

$wp_customize->add_setting('slider_social_icon_color', array(
    'default'   => '#fff',
    'transport' => 'refresh',
    'sanitize_callback' => 'sanitize_hex_color',
));
          
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'slider_social_icon_color', array(
    'section' => 'featured_slider_info_section',
    'description' => __('Social Icon Color', 'prime-fitness-gym'),
)));


