<?php
/**
 *	Featured Areas
 */
function mohali_featured_areas_customize_register( $wp_customize ) {
	
	
	//Featured Areas
	$wp_customize->add_panel(
		'mohali-featured-areas', array(
			'title'		=>	__('Featured Areas', 'mohali'),
			'priority'	=>	30
		)
	);

	//Featured Areas Section Generator
	$i = 0;
	for ($i = 1; $i < 3; $i++) :
		$wp_customize->add_section(
			'mohali-fa-'.$i, array(
				'title'		=>	__('Featured Posts Area - ', 'mohali').$i,
				'priority'	=>	10,
				'panel'		=>	'mohali-featured-areas'
			)
		);
		
		//Enable
		$wp_customize->add_setting(
			'mohali-fa-enable-'.$i, array(
				'default'		=>	0,
				'sanitize_callback'	=>	'absint' 
			)
		);
		
		$wp_customize->add_control(
			'mohali-fa-enable-'.$i, array(
				  'type' => 'checkbox',
				  'section'		=>	'mohali-fa-'.$i,
				  'label' => __( 'Enable','mohali' ),
				  'description' => __( 'Enable this Featured Area.','mohali' ),
				)	
		);
		
		//Category Select Box
		$wp_customize->add_setting(
			'mohali-fa-cat-'.$i, array(
				'default'		=>	0,
				'sanitize_callback'	=>	'absint' 
			)
		);
		
		$wp_customize->add_control(
			new mohali_WP_Customize_Category_Control(
				$wp_customize, 'mohali-fa-cat-'.$i, array(
					'label'		=>	__('Category', 'mohali'),
					'description'	=>	__('Category whose posts need to be featured', 'mohali'),
					'priority'		=>	10,
					'section'		=>	'mohali-fa-'.$i,
				)
			)
		);
		
		//Show Title Checkbox
		$wp_customize->add_setting(
			'mohali-fa-show-title-'.$i, array(
				'default'		=>	0,
				'sanitize_callback'	=>	'absint' 
			)
		);
		
		$wp_customize->add_control(
			'mohali-fa-show-title-'.$i, array(
				  'type' => 'checkbox',
				  'section'		=>	'mohali-fa-'.$i,
				  'label' => __( 'Show Title','mohali' ),
				  'description' => __( 'By Default, the category name will appear as the title above the featured section.','mohali' ),
				)	
		);
		
		$wp_customize->add_setting(
			'mohali-fa-style-'.$i, array(
				'default' => 'style1',
				'sanitize_callback'	=>	'mohali_sanitize_fa_style'
			)
		);
		
		$wp_customize->add_control(
			new mohali_Image_Radio_Control($wp_customize, 
				'mohali-fa-style-'.$i, array(
					'type' => 'radio',
					'label' => esc_html__('Select Featured Area Style', 'mohali'),
					'section' => 'mohali-fa-'.$i,
					'settings' => 'mohali-fa-style-'.$i,
					'choices' => array(
						'style1' => get_template_directory_uri() . '/inc/customizer/images/fa-style1.png',
						'style2' => get_template_directory_uri() . '/inc/customizer/images/fa-style2.png',

					)
				)
			)
		);
		
		
	endfor;	
	
}
add_action('customize_register', 'mohali_featured_areas_customize_register');