<?php 
/**
 * NEWS WEEKEND TOP SECTION SETTINGS
 */
Kirki::add_section( 'weekend_top_news_section', array(
	'title'    => esc_html__( 'Weekend Top News Section', 'newscope' ),
	'panel'    => 'newscope_front_page_options',
) );

Kirki::add_field( 'theme_config', [
	'type'        => 'switch',
	'settings'    => 'enable_weekend_top_news',
	'label'       => esc_html__( 'Enable Section', 'newscope' ),
	'section'     => 'weekend_top_news_section',
	'default'     => 'on',
	'priority'        => 1,
	'choices'     => [
		'on'  => esc_html__( 'Enable', 'newscope' ),
		'off' => esc_html__( 'Disable', 'newscope' ),
	],
	'partial_refresh'    => [
		'weekend_top_news_section_title_quick' => [
			'selector'        => '.weekend-top',
			'render_callback' => 'newscope_customizer_quickedit',
		],
	],
] );

new \Kirki\Field\Text(
	[
		'settings' => 'weekend_top_news_section_title',
		'label'    => esc_html__( 'Section Title', 'newscope' ),
		'section'  => 'weekend_top_news_section',
		'default'  => esc_html__( 'Weekend Top', 'newscope' ),
		'priority'        => 1,
        'active_callback' => [
            [
                'setting'  => 'enable_weekend_top_news',
                'operator' => '===',
                'value'    => true,
            ],
        ],
	]
);
new \Kirki\Field\Radio_Image(
	[
		'settings'    => 'weekend_top_news_section_title_tag_pro',
		'label'       => esc_html__( 'Purchase Pro', 'newscope' ),
		'description' => newscope_purchase_link(),
		'section'     => 'weekend_top_news_section',
		'default'     => '',
		'transport'   => 'auto',
		'choices'     => [
			'1'   => get_template_directory_uri() . '/assets/image/pro/html-tag2.jpg',
		],
		'active_callback' => [
            [
                'setting'  => 'enable_weekend_top_news',
                'operator' => '===',
                'value'    => true,
            ],
        ], 
	]
);

Kirki::add_field( 'theme_config', [
	'type'        => 'switch',
	'settings'    => 'enable_weekend_top_news_readmore',
	'label'       => esc_html__( 'Enable Read More Button', 'newscope' ),
	'section'     => 'weekend_top_news_section',
	'default'     => 'on',
	'choices'     => [
		'on'  => esc_html__( 'Enable', 'newscope' ),
		'off' => esc_html__( 'Disable', 'newscope' ),
	],
	'active_callback' => [
		[
			'setting'  => 'enable_weekend_top_news',
			'operator' => '===',
			'value'    => true,
		],
    ], 
] );
new \Kirki\Field\URL(
	[
		'settings' => 'weekend_top_news_btn_url',
		'label'    => esc_html__( 'Read More URL', 'newscope' ),
		'section'  => 'weekend_top_news_section',
		'default'  => '#',
        'active_callback' => [
            [
                'setting'  => 'enable_weekend_top_news',
                'operator' => '===',
                'value'    => true,
            ],
            [
                'setting'  => 'enable_weekend_top_news_readmore',
                'operator' => '===',
                'value'    => true,
            ]
        ],
	]
);
new \Kirki\Field\Text(
	[
		'settings' => 'weekend_top_news_btn_text',
		'label'    => esc_html__( 'Button Text', 'newscope' ),
		'section'  => 'weekend_top_news_section',
		'default'  => esc_html__( 'View All', 'newscope' ),
		'priority' => 10,
        'active_callback' => [
            [
                'setting'  => 'enable_weekend_top_news',
                'operator' => '===',
                'value'    => true,
            ],
            [
                'setting'  => 'enable_weekend_top_news_readmore',
                'operator' => '===',
                'value'    => true,
            ]
        ],
	]
);
//===========================================
//========== Main Section Slider Settings ============
//===========================================


Kirki::add_field( 'theme_config', [
	'type'        => 'switch',
	'settings'    => 'enable_weekend_top_news_filter',
	'label'       => esc_html__( 'Enable Post Filter', 'newscope' ),
	'section'     => 'weekend_top_news_section',
	'default'     => 'off',
	'choices'     => [
		'on'  => esc_html__( 'Enable', 'newscope' ),
		'off' => esc_html__( 'Disable', 'newscope' ),
	],
	'active_callback' => [
		[
			'setting'  => 'enable_weekend_top_news',
			'operator' => '===',
			'value'    => true,
		]
	],
] );

new \Kirki\Field\Select(
	[
		'settings'    => 'weekend_top_news_select_filter',
		'label'       => esc_html__( 'Select Category Or Tags', 'newscope' ),
		'section'     => 'weekend_top_news_section',
		'default'     => 'one',
		'choices'     => [
			'one' => esc_html__( 'Category', 'newscope' ),
			'two' => esc_html__( 'Tags', 'newscope' ),
		],
		'active_callback' => [
			[
				'setting'  => 'enable_weekend_top_news',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_weekend_top_news_filter',
				'operator' => '===',
				'value'    => true,
			]
		], 
	]
);

new Kirki\Field\Select(
	[
		'settings'    => 'weekend_top_news_post_cat',
		'label'       => __( 'Select Categroy', 'newscope' ),
		'section'     => 'weekend_top_news_section',
		'default'     => '',
		'multiple'    => -1,
		'placeholder' => __( 'Select an Categorys', 'newscope' ),
		'choices'     => Kirki\Util\Helper::get_terms(array('taxonomy' => 'category')),
		'active_callback' => [
			[
				'setting'  => 'weekend_top_news_select_filter',
				'operator' => '===',
				'value'    => 'one',
			],
			[
				'setting'  => 'enable_weekend_top_news_filter',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_weekend_top_news',
				'operator' => '===',
				'value'    => true,
			]
		], 
	]
);


new \Kirki\Field\Radio_Image(
	[
		'settings'    => 'weekend_top_news_post_tag_pro',
		'label'       => esc_html__( 'Purchase Pro', 'newscope' ),
		'description' => newscope_purchase_link(),
		'section'     => 'weekend_top_news_section',
		'default'     => '',
		'transport'   => 'auto',
		'choices'     => [
			'1'   => get_template_directory_uri() . '/assets/image/pro/tags-pro.jpg',
		],
		'active_callback' => [
			[
				'setting'  => 'weekend_top_news_select_filter',
				'operator' => '===',
				'value'    => 'two',
			],
			[
				'setting'  => 'enable_weekend_top_news_filter',
				'operator' => '===',
				'value'    => true,
			],
			[
				'setting'  => 'enable_weekend_top_news',
				'operator' => '===',
				'value'    => true,
			]
		],
	]
);

new \Kirki\Field\Select(
	[
		'settings'        => 'weekend_top_news_order',
		'label'           => esc_html__( 'Post Order', 'newscope' ),
		'section'         => 'weekend_top_news_section',
		'default'         => 'ASC',
		'placeholder'     => esc_html__( 'Choose an option', 'newscope' ),
		'choices'         => [
			'ASC'  => esc_html__( 'ASC', 'newscope' ),
			'DESE' => esc_html__( 'DESE', 'newscope' ),
		],
		'active_callback' => [
			[
				'setting'  => 'enable_weekend_top_news',
				'operator' => '===',
				'value'    => true,
			],
		], 
	]
);

new \Kirki\Field\Select(
	[
		'settings'        => 'weekend_top_news_postby',
		'label'           => esc_html__( 'Post Order By', 'newscope' ),
		'section'         => 'weekend_top_news_section',
		'default'         => 'rand',
		'placeholder'     => esc_html__( 'Choose an option', 'newscope' ),
		'choices'         => [
			'none'          => esc_html__( 'None', 'newscope' ),
			'ID'            => esc_html__( 'ID', 'newscope' ),
			'date'          => esc_html__( 'Date', 'newscope' ),
			'name'          => esc_html__( 'Name', 'newscope' ),
			'title'         => esc_html__( 'Title', 'newscope' ),
			'comment_count' => esc_html__( 'Comment count', 'newscope' ),
			'rand'          => esc_html__( 'Random', 'newscope' ),
		],
		'active_callback' => [
			[
				'setting'  => 'enable_weekend_top_news',
				'operator' => '===',
				'value'    => true,
			],
		],
	]
);
new \Kirki\Field\Radio_Image(
	[
		'settings'    => 'weekend_top_news_meta_pro',
		'label'       => esc_html__( 'Purchase Pro', 'newscope' ),
		'description' => newscope_purchase_link(),
		'section'     => 'weekend_top_news_section',
		'default'     => '',
		'transport'   => 'auto',
		'choices'     => [
			'1'   => get_template_directory_uri() . '/assets/image/pro/lanth-c-t-m-d.jpg',
		],
		'active_callback' => [
			[
				'setting'  => 'enable_weekend_top_news',
				'operator' => '===',
				'value'    => true,
			]
		],  
	]
);