<?php
/**
 *	Featured Areas
 */
function phnewspaper_featured_areas_customize_register( $wp_customize ) {
	
	
	//Featured Areas
	$wp_customize->add_panel(
		'phnewspaper-featured-areas', array(
			'title'		=>	__('Featured Areas', 'ph-news-paper'),
			'priority'	=>	30
		)
	);

	//Featured Areas Section Generator
	$i = 0;
	for ($i = 1; $i < 3; $i++) :
		$wp_customize->add_section(
			'phnewspaper-fa-'.$i, array(
				'title'		=>	__('Featured Posts Area - ', 'ph-news-paper').$i,
				'priority'	=>	10,
				'panel'		=>	'phnewspaper-featured-areas'
			)
		);
		
		//Enable
		$wp_customize->add_setting(
			'phnewspaper-fa-enable-'.$i, array(
				'default'		=>	0,
				'sanitize_callback'	=>	'absint' 
			)
		);
		
		$wp_customize->add_control(
			'phnewspaper-fa-enable-'.$i, array(
				  'type' => 'checkbox',
				  'section'		=>	'phnewspaper-fa-'.$i,
				  'label' => __( 'Enable','ph-news-paper' ),
				  'description' => __( 'Enable this Featured Area.','ph-news-paper' ),
				)	
		);
		
		//Category Select Box
		$wp_customize->add_setting(
			'phnewspaper-fa-cat-'.$i, array(
				'default'		=>	0,
				'sanitize_callback'	=>	'absint' 
			)
		);
		
		$wp_customize->add_control(
			new phnewspaper_WP_Customize_Category_Control(
				$wp_customize, 'phnewspaper-fa-cat-'.$i, array(
					'label'		=>	__('Category', 'ph-news-paper'),
					'description'	=>	__('Category whose posts need to be featured', 'ph-news-paper'),
					'priority'		=>	10,
					'section'		=>	'phnewspaper-fa-'.$i,
				)
			)
		);
		
		//Show Title Checkbox
		$wp_customize->add_setting(
			'phnewspaper-fa-show-title-'.$i, array(
				'default'		=>	0,
				'sanitize_callback'	=>	'absint' 
			)
		);
		
		$wp_customize->add_control(
			'phnewspaper-fa-show-title-'.$i, array(
				  'type' => 'checkbox',
				  'section'		=>	'phnewspaper-fa-'.$i,
				  'label' => __( 'Show Title','ph-news-paper' ),
				  'description' => __( 'By Default, the category name will appear as the title above the featured section.','ph-news-paper' ),
				)	
		);
		
		$wp_customize->add_setting(
			'phnewspaper-fa-style-'.$i, array(
				'default' => 'style1',
				'sanitize_callback'	=>	'phnewspaper_sanitize_fa_style'
			)
		);
		
		$wp_customize->add_control(
			new phnewspaper_Image_Radio_Control($wp_customize, 
				'phnewspaper-fa-style-'.$i, array(
					'type' => 'radio',
					'label' => esc_html__('Select Featured Area Style', 'ph-news-paper'),
					'section' => 'phnewspaper-fa-'.$i,
					'settings' => 'phnewspaper-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', 'phnewspaper_featured_areas_customize_register');