<?php
/**
 * Features Section options.
 *
 * @package Prime Beauty Salon
 */

$default = prime_beauty_salon_get_default_theme_options();

// Features Section
$wp_customize->add_section( 'prime_beauty_salon_section_featured_mission',
	array(
	'title'      => __( 'Features Section', 'prime-beauty-salon' ),
	'priority'   => 110,
	'capability' => 'edit_theme_options',
	'panel'      => 'home_page_panel',
	)
);

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

$wp_customize->add_control('theme_options[prime_beauty_salon_enable_featured_mission_section]', 
	array(		
	'label' 	=> __('Enable Section', 'prime-beauty-salon'),
	'section' 	=> 'prime_beauty_salon_section_featured_mission',
	'settings'  => 'theme_options[prime_beauty_salon_enable_featured_mission_section]',
	'type' 		=> 'checkbox',	
	)
);
// Section Title
$wp_customize->add_setting('theme_options[prime_beauty_salon_featured_mission_section_title]', 
	array(
	'default'           => $default['prime_beauty_salon_featured_mission_section_title'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'sanitize_text_field'
	)
);

$wp_customize->add_control('theme_options[prime_beauty_salon_featured_mission_section_title]', 
	array(
	'label'       => __('Section Title', 'prime-beauty-salon'),
	'section'     => 'prime_beauty_salon_section_featured_mission',   
	'settings'    => 'theme_options[prime_beauty_salon_featured_mission_section_title]',
	'active_callback' => 'prime_beauty_salon_featured_mission_active',
	'type'        => 'text'
	)
);

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

$wp_customize->add_control('theme_options[prime_beauty_salon_featured_mission_section_text]', 
	array(
	'label'       => __('Section Text', 'prime-beauty-salon'),
	'section'     => 'prime_beauty_salon_section_featured_mission',   
	'settings'    => 'theme_options[prime_beauty_salon_featured_mission_section_text]',
	'active_callback' => 'prime_beauty_salon_featured_mission_active',
	'type'        => 'text'
	)
);

// Items
$wp_customize->add_setting('theme_options[prime_beauty_salon_number_of_featured_mission_items]', 
	array(
	'default' 			=> $default['prime_beauty_salon_number_of_featured_mission_items'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'prime_beauty_salon_sanitize_number_range'
	)
);

$wp_customize->add_control('theme_options[prime_beauty_salon_number_of_featured_mission_items]', 
	array(
	'label'       => __('Items (Max: 5)', 'prime-beauty-salon'),
	'section'     => 'prime_beauty_salon_section_featured_mission',
	'settings'    => 'theme_options[prime_beauty_salon_number_of_featured_mission_items]',
	'type'        => 'number',
	'active_callback' => 'prime_beauty_salon_featured_mission_active',
	'input_attrs' => array(
			'min'	=> 1,
			'max'	=> 5,
			'step'	=> 1,
		),
	)
);

$prime_beauty_salon_number_of_featured_mission_items = prime_beauty_salon_get_option( 'prime_beauty_salon_number_of_featured_mission_items' );

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

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

	$wp_customize->add_control('theme_options[prime_beauty_salon_featured_mission_section_tab_'.$i.']', 
		array(
		'label'       => __('Tab #', 'prime-beauty-salon').$i,
		'section'     => 'prime_beauty_salon_section_featured_mission',
		'settings'    => 'theme_options[prime_beauty_salon_featured_mission_section_tab_'.$i.']',
		'active_callback' => 'prime_beauty_salon_featured_mission_active',
		'type'        => 'text'
		)
	);

	// Post
	$wp_customize->add_setting('theme_options[prime_beauty_salon_featured_mission_post_'.$i.']', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'prime_beauty_salon_dropdown_pages'
		)
	);

	$wp_customize->add_control('theme_options[prime_beauty_salon_featured_mission_post_'.$i.']', 
		array(
		'label'       => __('Page #', 'prime-beauty-salon').$i,
		'section'     => 'prime_beauty_salon_section_featured_mission',   
		'settings'    => 'theme_options[prime_beauty_salon_featured_mission_post_'.$i.']',
		'type'        => 'dropdown-pages',
		'active_callback' => 'prime_beauty_salon_featured_mission_active',
		)
	);
}

$wp_customize->add_setting(
	'prime_beauty_salon_image_path1',
	 array(
        'capability'        => 'edit_theme_options',
        'sanitize_callback' => 'esc_url_raw'
	)
);

$wp_customize->add_control( 
	new WP_Customize_Image_Control( $wp_customize, 
		'prime_beauty_salon_image_path1', 
		array(
	    'label' => 'Edit Image 1',
	    'settings'  => 'prime_beauty_salon_image_path1',
	    'section'   => 'prime_beauty_salon_section_featured_mission'
		) 
	)
);

$wp_customize->add_setting(
	'prime_beauty_salon_image_path2',
	 array(
        'capability'        => 'edit_theme_options',
        'sanitize_callback' => 'esc_url_raw'
	)
);

$wp_customize->add_control( 
	new WP_Customize_Image_Control( $wp_customize, 
		'prime_beauty_salon_image_path2', 
		array(
	    'label' => 'Edit Image 2',
	    'settings'  => 'prime_beauty_salon_image_path2',
	    'section'   => 'prime_beauty_salon_section_featured_mission'
		) 
	)
);