<?php
/**
 * Our Team options.
 *
 * @package Rock Studio
 */

$default = rock_studio_get_default_theme_options();

// Featured Our Team Section
$wp_customize->add_section( 'section_our_team',
	array(
	'title'      => __( 'Band Members', 'rock-studio' ),
	'priority'   => 100,
	'capability' => 'edit_theme_options',
	'panel'      => 'home_page_panel',
	)
);

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

$wp_customize->add_control('theme_options[enable_our_team_section]', 
	array(		
	'label' 	=> __('Enable Section', 'rock-studio'),
	'section' 	=> 'section_our_team',
	'settings'  => 'theme_options[enable_our_team_section]',
	'type' 		=> 'checkbox',	
	)
);

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

$wp_customize->add_control('theme_options[our_team_section_title]', 
	array(
	'label'       => __('Section Title', 'rock-studio'),
	'section'     => 'section_our_team',   
	'settings'    => 'theme_options[our_team_section_title]',	
	'active_callback' => 'rock_studio_our_team_active',		
	'type'        => 'text'
	)
);

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

$wp_customize->add_control('theme_options[number_of_our_team_items]', 
	array(
	'label'       => __('Number Of Items', 'rock-studio'),
	'description' => __('Save & Refresh the customizer to see its effect. Maximum is 12.', 'rock-studio'),
	'section'     => 'section_our_team',   
	'settings'    => 'theme_options[number_of_our_team_items]',		
	'type'        => 'number',
	'active_callback' => 'rock_studio_our_team_active',
	'input_attrs' => array(
			'min'	=> 1,
			'max'	=> 12,
			'step'	=> 1,
		),
	)
);

$number_of_our_team_items = rock_studio_get_option( 'number_of_our_team_items' );

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

	// Image
	$wp_customize->add_setting('theme_options[our_team_image_'.$i.']', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'rock_studio_sanitize_image'
		)
	);

	$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize,
		'theme_options[our_team_image_'.$i.']', 
		array(
		'label'       => sprintf( __('Image #%1$s', 'rock-studio'), $i),
		'section'     		=> 'section_our_team',   
		'settings'    		=> 'theme_options[our_team_image_'.$i.']',		
		'active_callback' 	=> 'rock_studio_our_team_active',
		'type'        		=> 'image',
		)
		)
	);

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

	$wp_customize->add_control('theme_options[our_team_name_'.$i.']', 
		array(
		'label'       => sprintf( __('Name #%1$s', 'rock-studio'), $i),
		'section'     => 'section_our_team',   
		'settings'    => 'theme_options[our_team_name_'.$i.']',		
		'active_callback' => 'rock_studio_our_team_active',		
		'type'        => 'text'
		)
	);

	$wp_customize->add_setting('theme_options[our_team_name_url_'.$i.']', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'esc_url_raw'
		)
	);

	$wp_customize->add_control('theme_options[our_team_name_url_'.$i.']', 
		array(
		'label'       => sprintf( __('Url #%1$s', 'rock-studio'), $i),
		'section'     => 'section_our_team',   
		'settings'    => 'theme_options[our_team_name_url_'.$i.']',		
		'active_callback' => 'rock_studio_our_team_active',		
		'type'        => 'url'
		)
	);

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

	$wp_customize->add_control('theme_options[our_team_position_'.$i.']', 
		array(
		'label'       => sprintf( __('Position #%1$s', 'rock-studio'), $i),
		'section'     => 'section_our_team',   
		'settings'    => 'theme_options[our_team_position_'.$i.']',		
		'active_callback' => 'rock_studio_our_team_active',		
		'type'        => 'text'
		)
	);

	// Social Link Url 1
	$wp_customize->add_setting('theme_options[our_team_social_link_one_'.$i.']', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'esc_url_raw'
		)
	);

	$wp_customize->add_control('theme_options[our_team_social_link_one_'.$i.']', 
		array(
		'label'       => sprintf( __('Social Link One #%1$s', 'rock-studio'), $i),
		'section'     => 'section_our_team',   
		'settings'    => 'theme_options[our_team_social_link_one_'.$i.']',		
		'active_callback' => 'rock_studio_our_team_active',		
		'type'        => 'url'
		)
	);

	// Social Link Url 2
	$wp_customize->add_setting('theme_options[our_team_social_link_two_'.$i.']', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'esc_url_raw'
		)
	);

	$wp_customize->add_control('theme_options[our_team_social_link_two_'.$i.']', 
		array(
		'label'       => sprintf( __('Social Link Two #%1$s', 'rock-studio'), $i),
		'section'     => 'section_our_team',   
		'settings'    => 'theme_options[our_team_social_link_two_'.$i.']',		
		'active_callback' => 'rock_studio_our_team_active',		
		'type'        => 'url'
		)
	);

	// Social Link Url 3
	$wp_customize->add_setting('theme_options[our_team_social_link_three_'.$i.']', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'esc_url_raw'
		)
	);

	$wp_customize->add_control('theme_options[our_team_social_link_three_'.$i.']', 
		array(
		'label'       => sprintf( __('Social Link Three #%1$s', 'rock-studio'), $i),
		'section'     => 'section_our_team',   
		'settings'    => 'theme_options[our_team_social_link_three_'.$i.']',		
		'active_callback' => 'rock_studio_our_team_active',		
		'type'        => 'url'
		)
	);

	// Social Link Url 4
	$wp_customize->add_setting('theme_options[our_team_social_link_four_'.$i.']', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'esc_url_raw'
		)
	);

	$wp_customize->add_control('theme_options[our_team_social_link_four_'.$i.']', 
		array(
		'label'       => sprintf( __('Social Link Four #%1$s', 'rock-studio'), $i),
		'section'     => 'section_our_team',   
		'settings'    => 'theme_options[our_team_social_link_four_'.$i.']',		
		'active_callback' => 'rock_studio_our_team_active',		
		'type'        => 'url'
		)
	);
}