<?php 
/**
 * Fields for color options
 * @since 1.0
 * @package evaWp
 */

function evawp_slider_options(){
	$evawp_cat = Kirki_Helper::get_terms( 'category' );
	$evawp_cat[ 0 ] = esc_html__( 'All', 'evawp' );
	evawp_add_sections_and_fields( array(
		'section' => array(
			'id' => 'slider_options',
			'title'          => esc_html__( 'Slider Options', 'evawp' ),
			'panel'          => 'front_page_options',
			'priority'       => 20,
		),
		'fields' => array(
			'enable_slider' => array(
				'type'        => 'toggle',
				'label'       => esc_html__( 'Enable', 'evawp' ),
				'default'     => true,
				'priority'    => 10,
			),
			'slider_type' => array(
				'type'        => 'radio-buttonset',
				'label'       => esc_html__( 'Featured News Type', 'evawp' ),
				'default'     => 'post',
				'priority'    => 20,
				'choices'     => array(
					'post'   => esc_html__( 'Latest Post', 'evawp' ),
					'category' => esc_html__( 'From Category', 'evawp' ),
				),
				'active_callback' => array(
					array(
						'setting'  => 'evawp_enable_slider_setting',
						'operator' => '==',
						'value'    => true,
					)
				),
			),
			'slider_category' => array(
    			'type'        => 'select',
    			'label'       => esc_html__( 'Select Category', 'evawp' ),
    			'default'     => 0,
    			'priority'    => 30,
    			'choices'     => $evawp_cat,
    			'active_callback' => array(
    				array(
	    				'setting'  => 'evawp_slider_type_setting',
	    				'operator' => '==',
	    				'value'    => 'category',	
    				),
    				array(
    					'setting'  => 'evawp_enable_slider_setting',
    					'operator' => '==',
    					'value'    => true,
    				)
    			),
			)
		)
	));
}

add_action( 'init', 'evawp_slider_options' );