<?php
/**
 * Theme Ostrich Customizer
 *
 * @package Return Blog
 *
 * hero_slider section
 */

$wp_customize->add_section(
	'return_blog_hero_slider',
	array(
		'title' => esc_html__( 'Hero Slider', 'return-blog' ),
		'panel' => 'return_blog_home_panel',
	)
);

// hero_slider enable settings
$wp_customize->add_setting(
	'return_blog_hero_slider',
	array(
		'sanitize_callback' => 'return_blog_sanitize_select',
		'default' => 'disable'
	)
);

$wp_customize->add_control(
	'return_blog_hero_slider',
	array(
		'section'		=> 'return_blog_hero_slider',
		'label'			=> esc_html__( 'Content type:', 'return-blog' ),
		'description'			=> esc_html__( 'Choose where you want to render the content from.', 'return-blog' ),
		'type'			=> 'select',
		'choices'		=> array( 
				'disable' => esc_html__( '--Disable--', 'return-blog' ),
				'page' => esc_html__( 'Page', 'return-blog' ),
		 	)
	)
);


for ($i=1; $i <= 4 ; $i++) { 
	// hero_slider post setting
	$wp_customize->add_setting(
		'return_blog_hero_slider_post_'.$i,
		array(
			'sanitize_callback' => 'return_blog_sanitize_dropdown_pages',
		)
	);

	$wp_customize->add_control(
		'return_blog_hero_slider_post_'.$i,
		array(
			'section'		=> 'return_blog_hero_slider',
			'label'			=> esc_html__( 'Post ', 'return-blog' ).$i,
			'active_callback' => 'return_blog_if_hero_slider_post',
			'type'			=> 'select',
			'choices'		=> return_blog_get_post_choices(),
		)
	);

	// hero_slider page setting
	$wp_customize->add_setting(
		'return_blog_hero_slider_page_'.$i,
		array(
			'sanitize_callback' => 'return_blog_sanitize_dropdown_pages',
			'default' => 0,
		)
	);

	$wp_customize->add_control(
		'return_blog_hero_slider_page_'.$i,
		array(
			'section'		=> 'return_blog_hero_slider',
			'label'			=> esc_html__( 'Page ', 'return-blog' ).$i,
			'type'			=> 'dropdown-pages',
			'active_callback' => 'return_blog_if_hero_slider_page'
		)
	);
}

// hero_slider category setting
$wp_customize->add_setting(
	'return_blog_hero_slider_cat',
	array(
		'sanitize_callback' => 'return_blog_sanitize_select',
	)
);

$wp_customize->add_control(
	'return_blog_hero_slider_cat',
	array(
		'section'		=> 'return_blog_hero_slider',
		'label'			=> esc_html__( 'Category:', 'return-blog' ),
		'active_callback' => 'return_blog_if_hero_slider_cat',
		'type'			=> 'select',
		'choices'		=> return_blog_get_post_cat_choices(),
	)
);
