<?php
/**
 * Choose Us options.
 *
 * @package Business Carter
 */

$default = business_carter_get_default_theme_options();

// Choose Us Section
$wp_customize->add_section( 'section_choose_us',
	array(
	'title'      		=> __( 'Choose Us Section', 'business-carter' ),
	'priority'   		=> 100,
	'capability' 		=> 'edit_theme_options',
	'panel'      		=> 'home_page_panel',
	)
);

// Enable Choose Us Section
$wp_customize->add_setting('theme_options[enable_choose_us_section]', 
	array(
	'default' 			=> $default['enable_choose_us_section'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',
	'sanitize_callback' => 'business_carter_sanitize_checkbox'
	)
);

$wp_customize->add_control('theme_options[enable_choose_us_section]', 
	array(		
	'label' 			=> __('Enable Section', 'business-carter'),
	'description' => __('Go to Customize - Homepage Settings. Select A static page. Set Homepage as Home and Posts page as Blog to show this section.', 'business-carter'),
	'section' 			=> 'section_choose_us',
	'settings'  		=> 'theme_options[enable_choose_us_section]',
	'type' 				=> 'checkbox',	
	)
);

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

$wp_customize->add_control('theme_options[business_carter_choose_us_section_subtitle]', 
	array(
	'label' 	  		=> __('Subtitle', 'business-carter'),
	'section'     		=> 'section_choose_us',   
	'settings'    		=> 'theme_options[business_carter_choose_us_section_subtitle]',		
	'active_callback' 	=> 'business_carter_choose_us_active',		
	'type'        		=> 'text'
	)
);

// Title
$wp_customize->add_setting('theme_options[business_carter_choose_us_section_title]', 
	array(
	'default'           => $default['business_carter_choose_us_section_title'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'sanitize_text_field'
	)
);

$wp_customize->add_control('theme_options[business_carter_choose_us_section_title]', 
	array(
	'label' 			=> __('Title', 'business-carter'),
	'section'       	=> 'section_choose_us',   
	'settings'      	=> 'theme_options[business_carter_choose_us_section_title]',		
	'active_callback' 	=> 'business_carter_choose_us_active',		
	'type'        		=> 'text'
	)
);

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

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

$business_carter_number_of_choose_us_items = business_carter_get_option( 'business_carter_number_of_choose_us_items' );

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

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

	$wp_customize->add_control('theme_options[business_carter_choose_us_icon_'.$i.']', 
		array(
		'label'       		=> sprintf( __('Icon #%1$s', 'business-carter'), $i),
		'section'     		=> 'section_choose_us',   
		'settings'    		=> 'theme_options[business_carter_choose_us_icon_'.$i.']',		
		'active_callback' 	=> 'business_carter_choose_us_active',			
		'type'        		=> 'text',
		)
	);

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

	$wp_customize->add_control('theme_options[business_carter_choose_us_title_'.$i.']', 
		array(
		'label'       		=> sprintf( __('Title #%1$s', 'business-carter'), $i),
		'section'     		=> 'section_choose_us',   
		'settings'    		=> 'theme_options[business_carter_choose_us_title_'.$i.']',		
		'active_callback' 	=> 'business_carter_choose_us_active',		
		'type'        		=> 'text'
		)
	);
}

// Button Label
$wp_customize->add_setting('theme_options[business_carter_choose_us_btn_label]', 
	array(
	'default' 			=> $default['business_carter_choose_us_btn_label'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'sanitize_text_field'
	)
);

$wp_customize->add_control('theme_options[business_carter_choose_us_btn_label]', 
	array(
	'label'       		=> sprintf( __('Button Label', 'business-carter')),
	'section'     		=> 'section_choose_us',   
	'settings'    		=> 'theme_options[business_carter_choose_us_btn_label]',		
	'active_callback' 	=> 'business_carter_choose_us_active',		
	'type'        		=> 'text'
	)
);

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

$wp_customize->add_control('theme_options[business_carter_choose_us_btn_url]', 
	array(
	'label'       		=> sprintf( __('Button Url', 'business-carter')),
	'section'     		=> 'section_choose_us',   
	'settings'    		=> 'theme_options[business_carter_choose_us_btn_url]',		
	'active_callback' 	=> 'business_carter_choose_us_active',		
	'type'        		=> 'url'
	)
);