<?php
/**
 * Trending Post options.
 *
 * @package New BlogBell
 */

$default = new_blogbell_get_default_theme_options();
$homepage_design_layout     = new_blogbell_get_option( 'homepage_design_layout_options' );

// Blog & Section
$wp_customize->add_section( 'section_home_fixheight',
	array(
		'title'      => __( 'Trending Section', 'new-blogbell' ),
		'capability' => 'edit_theme_options',
		'panel'      => 'home_page_panel',
		)
);

$wp_customize->add_setting( 'theme_options[disable_fixheight_section]',
	array(
		'default'           => $default['disable_fixheight_section'],
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'new_blogbell_sanitize_switch_control',
	)
);
$wp_customize->add_control( new New_BlogBell_Switch_Control( $wp_customize, 'theme_options[disable_fixheight_section]',
    array(
		'label' 			=> __('Enable/Disable Trending Section', 'new-blogbell'),
		'section'    		=> 'section_home_fixheight',
		 'settings'  		=> 'theme_options[disable_fixheight_section]',
		'on_off_label' 		=> new_blogbell_switch_options(),
    )
) );

//Must Read Post Section title
$wp_customize->add_setting('theme_options[fixheight_title]', 
	array(
	'default'           => $default['fixheight_title'],
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'sanitize_text_field'
	)
);

$wp_customize->add_control('theme_options[fixheight_title]', 
	array(
	'label'       => __('Section Title', 'new-blogbell'),
	'section'     => 'section_home_fixheight',   
	'settings'    => 'theme_options[fixheight_title]',
	'active_callback' => 'new_blogbell_fixheight_active',		
	'type'        => 'text'
	)
);
if ($homepage_design_layout=='home-main') {
	//Sensational Section title
	$wp_customize->add_setting('theme_options[fixheight_see_all_txt]', 
		array(
		'default'           => $default['fixheight_see_all_txt'],
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'sanitize_text_field'
		)
	);

	$wp_customize->add_control('theme_options[fixheight_see_all_txt]', 
		array(
		'label'       => __('See All Text', 'new-blogbell'),
		'section'     => 'section_home_fixheight',   
		'settings'    => 'theme_options[fixheight_see_all_txt]',
		'active_callback' => 'new_blogbell_fixheight_active',		
		'type'        => 'text'
		)
	);

	//Sensational Section title
	$wp_customize->add_setting('theme_options[fixheight_see_all_url]', 
		array(
		'type'              => 'theme_mod',
		'capability'        => 'edit_theme_options',	
		'sanitize_callback' => 'esc_url_raw'
		)
	);

	$wp_customize->add_control('theme_options[fixheight_see_all_url]', 
		array(
		'label'       => __('See All Link', 'new-blogbell'),
		'section'     => 'section_home_fixheight',   
		'settings'    => 'theme_options[fixheight_see_all_url]',
		'active_callback' => 'new_blogbell_fixheight_active',		
		'type'        => 'url'
		)
	);
}
// Add arrow enable setting and control.
$wp_customize->add_setting( 'theme_options[fixheight_content_align]', array(
	'default'           => $default['fixheight_content_align'],
	'sanitize_callback' => 'new_blogbell_sanitize_select',
) );

$wp_customize->add_control( 'theme_options[fixheight_content_align]', array(
	'label'             => esc_html__( 'Choose Content Align', 'new-blogbell' ),
	'section'           => 'section_home_fixheight',
	'type'              => 'radio',
	'active_callback' => 'new_blogbell_fixheight_active',
	'choices'				=> array( 
		'content-right'     => esc_html__( 'Right Side', 'new-blogbell' ), 
		'content-center'     => esc_html__( 'Center Side', 'new-blogbell' ), 
		'content-left'     => esc_html__( 'Left Side', 'new-blogbell' ), 
		'content-justify'     => esc_html__( 'Justify', 'new-blogbell' )
		)
) );

// Add category enable setting and control.
$wp_customize->add_setting( 'theme_options[fixheight_right_category_enable]', array(
	'default'           => $default['fixheight_right_category_enable'],
	'sanitize_callback' => 'new_blogbell_sanitize_checkbox',
) );

$wp_customize->add_control( 'theme_options[fixheight_right_category_enable]', array(
	'label'             => esc_html__( 'Enable Category of Left Post', 'new-blogbell' ),
	'section'           => 'section_home_fixheight',
	'type'              => 'checkbox',
	'active_callback' => 'new_blogbell_fixheight_active',
) );	
// Add content enable setting and control.
$wp_customize->add_setting( 'theme_options[fixheight_right_content_enable]', array(
	'default'           => $default['fixheight_right_content_enable'],
	'sanitize_callback' => 'new_blogbell_sanitize_checkbox',
) );

$wp_customize->add_control( 'theme_options[fixheight_right_content_enable]', array(
	'label'             => esc_html__( 'Enable Content of Left Post', 'new-blogbell' ),
	'section'           => 'section_home_fixheight',
	'type'              => 'checkbox',
	'active_callback' => 'new_blogbell_fixheight_active',
) );

// Add posted on enable setting and control.
$wp_customize->add_setting( 'theme_options[fixheight_right_posted_on_enable]', array(
	'default'           => $default['fixheight_right_posted_on_enable'],
	'sanitize_callback' => 'new_blogbell_sanitize_checkbox',
) );

$wp_customize->add_control( 'theme_options[fixheight_right_posted_on_enable]', array(
	'label'             => esc_html__( 'Enable Date of Left Post', 'new-blogbell' ),
	'section'           => 'section_home_fixheight',
	'type'              => 'checkbox',
	'active_callback' => 'new_blogbell_fixheight_active',
) );

// Add posted on enable setting and control.
$wp_customize->add_setting( 'theme_options[fixheight_right_author_enable]', array(
	'default'           => $default['fixheight_right_author_enable'],
	'sanitize_callback' => 'new_blogbell_sanitize_checkbox',
) );

$wp_customize->add_control( 'theme_options[fixheight_right_author_enable]', array(
	'label'             => esc_html__( 'Enable Author of Left Post', 'new-blogbell' ),
	'section'           => 'section_home_fixheight',
	'type'              => 'checkbox',
	'active_callback' => 'new_blogbell_fixheight_active',
) );

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

$wp_customize->add_control('theme_options[fixheight_right_excerpt_length]', 
	array(
	'label'       => __('Left Content Excerpt Length', 'new-blogbell'),
	'description' => __('Save & Refresh the customizer to see its effect. Maximum is 1000.', 'new-blogbell'),
	'section'     => 'section_home_fixheight',   
	'settings'    => 'theme_options[fixheight_right_excerpt_length]',		
	'type'        => 'number',
	'active_callback' => 'new_blogbell_fixheight_active',
	'input_attrs' => array(
			'min'	=> 0,
			'max'	=> 1000,
			'step'	=> 1,
		),
	)
);

// Additional Information First Post
$wp_customize->add_setting('theme_options[fixheight_right_post]', 
	array(
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'new_blogbell_dropdown_posts'
	)
);
$wp_customize->add_control( new New_BlogBell_Dropdown_Chooser( $wp_customize,'theme_options[fixheight_right_post]', 
	array(
	'label'       => __('Select Post', 'new-blogbell'),
	'section'     => 'section_home_fixheight',  
	'settings'    => 'theme_options[fixheight_right_post]',	
	'choices'			=> new_blogbell_post_choices(),	
	'type'        => 'dropdown-posts',
	'active_callback' => 'new_blogbell_fixheight_active',
	)
));
// Video Url 
$wp_customize->add_setting('theme_options[fixheight_video_link]', 
	array(
	'type'              => 'theme_mod',
	'capability'        => 'edit_theme_options',	
	'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control('theme_options[fixheight_video_link]', 
	array(
	'label'       => __('Video Link', 'new-blogbell'),
	'section'     => 'section_home_fixheight',   
	'settings'    => 'theme_options[fixheight_video_link]',	
	'active_callback' => 'new_blogbell_fixheight_active',	
	'type'        => 'url',
	)
);

// Add category enable setting and control.
$wp_customize->add_setting( 'theme_options[fixheight_category_enable]', array(
	'default'           => $default['fixheight_category_enable'],
	'sanitize_callback' => 'new_blogbell_sanitize_checkbox',
) );

$wp_customize->add_control( 'theme_options[fixheight_category_enable]', array(
	'label'             => esc_html__( 'Enable Category', 'new-blogbell' ),
	'section'           => 'section_home_fixheight',
	'type'              => 'checkbox',
	'active_callback' => 'new_blogbell_fixheight_active',
) );	
// Add content enable setting and control.
$wp_customize->add_setting( 'theme_options[fixheight_content_enable]', array(
	'default'           => $default['fixheight_content_enable'],
	'sanitize_callback' => 'new_blogbell_sanitize_checkbox',
) );

$wp_customize->add_control( 'theme_options[fixheight_content_enable]', array(
	'label'             => esc_html__( 'Enable Content', 'new-blogbell' ),
	'section'           => 'section_home_fixheight',
	'type'              => 'checkbox',
	'active_callback' => 'new_blogbell_fixheight_active',
) );

// Add posted on enable setting and control.
$wp_customize->add_setting( 'theme_options[fixheight_posted_on_enable]', array(
	'default'           => $default['fixheight_posted_on_enable'],
	'sanitize_callback' => 'new_blogbell_sanitize_checkbox',
) );

$wp_customize->add_control( 'theme_options[fixheight_posted_on_enable]', array(
	'label'             => esc_html__( 'Enable Date', 'new-blogbell' ),
	'section'           => 'section_home_fixheight',
	'type'              => 'checkbox',
	'active_callback' => 'new_blogbell_fixheight_active',
) );

// Add posted on enable setting and control.
$wp_customize->add_setting( 'theme_options[fixheight_author_enable]', array(
	'default'           => $default['fixheight_author_enable'],
	'sanitize_callback' => 'new_blogbell_sanitize_checkbox',
) );

$wp_customize->add_control( 'theme_options[fixheight_author_enable]', array(
	'label'             => esc_html__( 'Enable Author', 'new-blogbell' ),
	'section'           => 'section_home_fixheight',
	'type'              => 'checkbox',
	'active_callback' => 'new_blogbell_fixheight_active',
) );

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

$wp_customize->add_control('theme_options[fixheight_excerpt_length]', 
	array(
	'label'       => __('Excerpt Length', 'new-blogbell'),
	'description' => __('Save & Refresh the customizer to see its effect. Maximum is 1000.', 'new-blogbell'),
	'section'     => 'section_home_fixheight',   
	'settings'    => 'theme_options[fixheight_excerpt_length]',		
	'type'        => 'number',
	'active_callback' => 'new_blogbell_fixheight_active',
	'input_attrs' => array(
			'min'	=> 0,
			'max'	=> 1000,
			'step'	=> 1,
		),
	)
);

// Setting  Team Category.
$wp_customize->add_setting( 'theme_options[fixheight_category]',
	array(

	'capability'        => 'edit_theme_options',
	'sanitize_callback' => 'absint',
	)
);
$wp_customize->add_control(
	new New_BlogBell_Dropdown_Taxonomies_Control( $wp_customize, 'theme_options[fixheight_category]',
		array(
		'label'    => __( 'Select Category', 'new-blogbell' ),
		'section'  => 'section_home_fixheight',
		'settings' => 'theme_options[fixheight_category]',	
		'active_callback' => 'new_blogbell_fixheight_active',		
		)
	)
);
