<?php
/**
 * Flash News options.
 *
 * @package Magazine Bell
 */

$default = magazine_bell_get_default_theme_options();

// Flash News Section
$wp_customize->add_section( 'section_home_flash',
	array(
		'title'      => __( 'Flash News Section', 'magazine-bell' ),
		'capability' => 'edit_theme_options',
		'panel'      => 'home_page_panel',
		)
);

$wp_customize->add_setting( 'theme_options[disable_flash_section]',
	array(
		'default'           => $default['disable_flash_section'],
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'magazine_bell_sanitize_switch_control',
	)
);
$wp_customize->add_control( new Magazine_Bell_Switch_Control( $wp_customize, 'theme_options[disable_flash_section]',
    array(
		'label' 			=> __('Enable/Disable Flash News Section', 'magazine-bell'),
		'section'    		=> 'section_home_flash',
		 'settings'  		=> 'theme_options[disable_flash_section]',
		'on_off_label' 		=> magazine_bell_switch_options(),
    )
) );
//Sensational Section title
$wp_customize->add_setting('theme_options[flash_title]', 
	array(
	'default'           => $default['flash_title'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'sanitize_text_field'
	)
);

$wp_customize->add_control('theme_options[flash_title]', 
	array(
	'label'       => __('Section Title', 'magazine-bell'),
	'section'     => 'section_home_flash',   
	'settings'    => 'theme_options[flash_title]',
	'active_callback' => 'magazine_bell_flash_active',		
	'type'        => 'text'
	)
);

$number_of_flash_items = magazine_bell_get_option( 'number_of_flash_items' );

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

	// Posts
	$wp_customize->add_setting('theme_options[flash_post_'.$i.']', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'magazine_bell_dropdown_pages'
		)
	);

	$wp_customize->add_control('theme_options[flash_post_'.$i.']', 
		array(
		'label'       => sprintf( __('Select Post #%1$s', 'magazine-bell'), $i),
		'section'     => 'section_home_flash',   
		'settings'    => 'theme_options[flash_post_'.$i.']',		
		'type'        => 'select',
		'choices'	  => magazine_bell_post_choices(),
		'active_callback' => 'magazine_bell_flash_active',
		)
	);
}
