<?php
/**
 * Featured Slider options.
 *
 * @package Spirit Business
 */

$spirit_business_default = spirit_business_get_default_theme_options();

// Featured Featured Slider Section
$wp_customize->add_section( 'section_featured_slider',
	array(
	'title'      => __( 'Slider Section', 'spirit-business' ),
	'priority'   => 100,
	'capability' => 'edit_theme_options',
	'panel'      => 'home_page_panel',
	)
);

// Enable Featured Slider Section
$wp_customize->add_setting('theme_options[enable_featured_slider_section]', 
	array(
	'default' 			=> $spirit_business_default['enable_featured_slider_section'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',
	'sanitize_callback' => 'spirit_business_sanitize_checkbox'
	)
);

$wp_customize->add_control('theme_options[enable_featured_slider_section]', 
	array(		
	'label' 	=> __('Enable Featured Slider Section', 'spirit-business'),
	'section' 	=> 'section_featured_slider',
	'settings'  => 'theme_options[enable_featured_slider_section]',
	'type' 		=> 'checkbox',	
	)
);

// Number of items
$wp_customize->add_setting('theme_options[number_of_featured_slider_items]', 
	array(
	'default' 			=> $spirit_business_default['number_of_featured_slider_items'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'spirit_business_sanitize_number_range'
	)
);

$wp_customize->add_control('theme_options[number_of_featured_slider_items]', 
	array(
	'label'       => __('Number Of Slide Items', 'spirit-business'),
	'description' => __('Save & Refresh the customizer to see its effect. Maximum is 50.', 'spirit-business'),
	'section'     => 'section_featured_slider',   
	'settings'    => 'theme_options[number_of_featured_slider_items]',		
	'type'        => 'number',
	'active_callback' => 'spirit_business_featured_slider_active',
	'input_attrs' => array(
			'min'	=> 1,
			'max'	=> 50,
			'step'	=> 1,
		),
	)
);

$wp_customize->add_setting('theme_options[featured_slider_content_type]', 
	array(
	'default' 			=> $spirit_business_default['featured_slider_content_type'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'spirit_business_sanitize_select'
	)
);

$wp_customize->add_control('theme_options[featured_slider_content_type]', 
	array(
	'label'       => __('Content Type', 'spirit-business'),
	'section'     => 'section_featured_slider',   
	'settings'    => 'theme_options[featured_slider_content_type]',		
	'type'        => 'select',
	'active_callback' => 'spirit_business_featured_slider_active',
	'choices'	  => array(
			'featured_slider_page'	  => __('Page','spirit-business'),
			'featured_slider_post'	  => __('Post','spirit-business'),
			'featured_slider_category' => __('Category','spirit-business'),
		),
	)
);

$spirit_business_number_of_featured_slider_items = spirit_business_get_option( 'number_of_featured_slider_items' );

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

	// Subtitle
	$wp_customize->add_setting('theme_options[featured_slider_subtitle_'.$i.']', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'sanitize_text_field'
		)
	);

	$wp_customize->add_control('theme_options[featured_slider_subtitle_'.$i.']', 
		array(
		'label'       => sprintf( __('Subtitle #%1$s', 'spirit-business'), $i),
		'section'     => 'section_featured_slider',   
		'settings'    => 'theme_options[featured_slider_subtitle_'.$i.']',		
		'active_callback' => 'spirit_business_featured_slider_active',
		'type'        => 'text'
		)
	);

	// Page
	$wp_customize->add_setting('theme_options[featured_slider_page_'.$i.']', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'spirit_business_dropdown_pages'
		)
	);

	$wp_customize->add_control('theme_options[featured_slider_page_'.$i.']', 
		array(
		'label'       => sprintf( __('Select Page #%1$s', 'spirit-business'), $i),
		'section'     => 'section_featured_slider',   
		'settings'    => 'theme_options[featured_slider_page_'.$i.']',		
		'type'        => 'dropdown-pages',
		'active_callback' => 'spirit_business_featured_slider_page'
		)
	);

	// Posts
	$wp_customize->add_setting('theme_options[featured_slider_post_'.$i.']', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'spirit_business_dropdown_pages'
		)
	);

	$wp_customize->add_control('theme_options[featured_slider_post_'.$i.']', 
		array(
		'label'       => sprintf( __('Select Post #%1$s', 'spirit-business'), $i),
		'section'     => 'section_featured_slider',   
		'settings'    => 'theme_options[featured_slider_post_'.$i.']',		
		'type'        => 'select',
		'choices'	  => spirit_business_dropdown_posts(),
		'active_callback' => 'spirit_business_featured_slider_post'
		)
	);

	// Button Text One
	$wp_customize->add_setting('theme_options[featured_slider_btn_text_one_'.$i.']', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'sanitize_text_field'
		)
	);

	$wp_customize->add_control('theme_options[featured_slider_btn_text_one_'.$i.']', 
		array(
		'label'       => sprintf( __('Button Text One #%1$s', 'spirit-business'), $i),
		'section'     => 'section_featured_slider',   
		'settings'    => 'theme_options[featured_slider_btn_text_one_'.$i.']',	
		'active_callback' => 'spirit_business_featured_slider_active',	
		'type'        => 'text'
		)
	);

	// Button Text Two
	$wp_customize->add_setting('theme_options[featured_slider_btn_text_two_'.$i.']', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'sanitize_text_field'
		)
	);

	$wp_customize->add_control('theme_options[featured_slider_btn_text_two_'.$i.']', 
		array(
		'label'       => sprintf( __('Button Text Two #%1$s', 'spirit-business'), $i),
		'section'     => 'section_featured_slider',   
		'settings'    => 'theme_options[featured_slider_btn_text_two_'.$i.']',	
		'active_callback' => 'spirit_business_featured_slider_active',	
		'type'        => 'text'
		)
	);

	// Button Url Two
	$wp_customize->add_setting('theme_options[featured_slider_btn_url_two_'.$i.']', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'esc_url_raw'
		)
	);

	$wp_customize->add_control('theme_options[featured_slider_btn_url_two_'.$i.']', 
		array(
		'label'       => sprintf( __('Button Url Two #%1$s', 'spirit-business'), $i),
		'section'     => 'section_featured_slider',   
		'settings'    => 'theme_options[featured_slider_btn_url_two_'.$i.']',	
		'active_callback' => 'spirit_business_featured_slider_active',	
		'type'        => 'url'
		)
	);
}

// Setting Category.
$wp_customize->add_setting( 'theme_options[featured_slider_category]',
	array(
	'capability'        => 'edit_theme_options',
	'sanitize_callback' => 'absint',
	)
);
$wp_customize->add_control(
	new spirit_business_Dropdown_Taxonomies_Control( $wp_customize, 'theme_options[featured_slider_category]',
		array(
		'label'    => __( 'Select Category', 'spirit-business' ),
		'section'  => 'section_featured_slider',
		'settings' => 'theme_options[featured_slider_category]',	
		'active_callback' => 'spirit_business_featured_slider_category'
		)
	)
);

// Slider Speed
$wp_customize->add_setting('theme_options[data_slick_speed]', 
	array(
	'default' 			=> $spirit_business_default['data_slick_speed'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'spirit_business_sanitize_number_range'
	)
);

$wp_customize->add_control('theme_options[data_slick_speed]', 
	array(
	'label'       		=> __('Slider Speed', 'spirit-business'),
	'description' 		=> __('Save & Refresh the customizer to see its effect. Maximum is 5000.', 'spirit-business'),
	'section'     		=> 'section_featured_slider',   
	'settings'    		=> 'theme_options[data_slick_speed]',		
	'type'        		=> 'number',
	'active_callback' => 'spirit_business_featured_slider_active',
	'input_attrs' => array(
			'min'	=> 0,
			'max'	=> 5000,
			'step'	=> 100,
		),
	)
);

// Slider Arrows
$wp_customize->add_setting('theme_options[data_slick_arrows]', 
	array(
	'default' 			=> $spirit_business_default['data_slick_arrows'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',
	'sanitize_callback' => 'spirit_business_sanitize_checkbox'
	)
);

$wp_customize->add_control('theme_options[data_slick_arrows]', 
	array(		
	'label' 	=> __('Slider Arrows', 'spirit-business'),
	'section' 	=> 'section_featured_slider',
	'settings'  => 'theme_options[data_slick_arrows]',
	'active_callback' => 'spirit_business_featured_slider_active',
	'type' 		=> 'checkbox',	
	)
);

// Slider Dots
$wp_customize->add_setting('theme_options[data_slick_dots]', 
	array(
	'default' 			=> $spirit_business_default['data_slick_dots'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',
	'sanitize_callback' => 'spirit_business_sanitize_checkbox'
	)
);

$wp_customize->add_control('theme_options[data_slick_dots]', 
	array(		
	'label' 	=> __('Slider Dots', 'spirit-business'),
	'section' 	=> 'section_featured_slider',
	'settings'  => 'theme_options[data_slick_dots]',
	'active_callback' => 'spirit_business_featured_slider_active',
	'type' 		=> 'checkbox',	
	)
);

// Slider Fade
$wp_customize->add_setting('theme_options[data_slick_fade]', 
	array(
	'default' 			=> $spirit_business_default['data_slick_fade'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',
	'sanitize_callback' => 'spirit_business_sanitize_checkbox'
	)
);

$wp_customize->add_control('theme_options[data_slick_fade]', 
	array(		
	'label' 	=> __('Slider Fade', 'spirit-business'),
	'section' 	=> 'section_featured_slider',
	'settings'  => 'theme_options[data_slick_fade]',
	'active_callback' => 'spirit_business_featured_slider_active',
	'type' 		=> 'checkbox',	
	)
);

// Slider Infinite
$wp_customize->add_setting('theme_options[data_slick_infinite]', 
	array(
	'default' 			=> $spirit_business_default['data_slick_infinite'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',
	'sanitize_callback' => 'spirit_business_sanitize_checkbox'
	)
);

$wp_customize->add_control('theme_options[data_slick_infinite]', 
	array(		
	'label' 	=> __('Slide Infinite', 'spirit-business'),
	'section' 	=> 'section_featured_slider',
	'settings'  => 'theme_options[data_slick_infinite]',
	'active_callback' => 'spirit_business_featured_slider_active',
	'type' 		=> 'checkbox',	
	)
);

// Slider Autoplay
$wp_customize->add_setting('theme_options[data_slick_autoplay]', 
	array(
	'default' 			=> $spirit_business_default['data_slick_autoplay'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',
	'sanitize_callback' => 'spirit_business_sanitize_checkbox'
	)
);

$wp_customize->add_control('theme_options[data_slick_autoplay]', 
	array(		
	'label' 	=> __('Slider Autoplay', 'spirit-business'),
	'section' 	=> 'section_featured_slider',
	'settings'  => 'theme_options[data_slick_autoplay]',
	'active_callback' => 'spirit_business_featured_slider_active',
	'type' 		=> 'checkbox',	
	)
);

// Slider Draggable
$wp_customize->add_setting('theme_options[data_slick_draggable]', 
	array(
	'default' 			=> $spirit_business_default['data_slick_draggable'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',
	'sanitize_callback' => 'spirit_business_sanitize_checkbox'
	)
);

$wp_customize->add_control('theme_options[data_slick_draggable]', 
	array(		
	'label' 	=> __('Slider Draggable', 'spirit-business'),
	'section' 	=> 'section_featured_slider',
	'settings'  => 'theme_options[data_slick_draggable]',
	'active_callback' => 'spirit_business_featured_slider_active',
	'type' 		=> 'checkbox',	
	)
);