<?php 
/**
 * Fields For header category
 * @since 1.0
 * @package RoyalNews
 */

function royalnews_customizer_header_category( $section ){
	$section[ 'header_cat_options' ] = array(
		'title' => esc_html__( 'Header Category Options', 'royalnews' ),
		'priority'    => 10,
		'fields' => array(
			'enable-header-cat' => array(
				'type' => 'toggle',
				'label' => esc_html__( 'Enable Header Category', 'royalnews' ),
				'default' => true,
				'priority'    => 10,
			),
			'categoty-title-text' => array(
				'type'        => 'text',
				'label'       => esc_html__( 'Title', 'royalnews' ),
				'default'     => esc_html__( 'Top Categories', 'royalnews' ),
				'active_callback' => array(
					array(
						'setting'  => 'enable-header-cat',
						'operator' => '==',
						'value'    => true,
					)
				),
				'partial' => array(
				    'selector' => '.royalnews-category-title',
				)
			),
			'number-of-cat' => array(
				'type'        => 'number',
				'label'       => esc_html__( 'Number Of Category', 'royalnews' ),
				'default'     => 5,
				'active_callback' => array(
					array(
						'setting'  => 'enable-header-cat',
						'operator' => '==',
						'value'    => true,
					)
				),
			),
			'cat-bg-color'    => array(
			    'label' => esc_html__( 'Background Color', 'royalnews' ),
			    'type'  => 'color',
			    'default'   => '#d82926',
			    'active_callback' => array(
			    	array(
			    		'setting'  => 'enable-header-cat',
			    		'operator' => '==',
			    		'value'    => true,
			    	)
			    ),
			    'output' => array(
			        array(
			            'element'  => '.royalnews-header-cat-wrap, .royalnews-stories-main-wrapper .royalnews-exclusive-posts .royalnews-top-stories',
			            'property' => 'background',
			        )
			    ),
			),
			'cat-item-bg-color'    => array(
			    'label' => esc_html__( 'Item Background Color', 'royalnews' ),
			    'type'  => 'color',
			    'default'   => '#000000',
			    'active_callback' => array(
			    	array(
			    		'setting'  => 'enable-header-cat',
			    		'operator' => '==',
			    		'value'    => true,
			    	)
			    ),
			    'output' => array(
			        array(
			            'element'  => '.royalnews-header-cat-wrap .royalnews-header-cat .royalnews-header-cat-inner a',
			            'property' => 'background',
			        )
			    ),
			),
			'cat-text-color'    => array(
			    'label' => esc_html__( 'Text Color', 'royalnews' ),
			    'type'  => 'color',
			    'default'   => '#ffffff',
			    'active_callback' => array(
			    	array(
			    		'setting'  => 'enable-header-cat',
			    		'operator' => '==',
			    		'value'    => true,
			    	)
			    ),
			    'output' => array(
			        array(
			            'element'  => '.royalnews-header-cat-wrap .royalnews-header-cat .royalnews-header-cat-inner a, .royalnews-header-cat-wrap .royalnews-header-cat .royalnews-category-title',
			            'property' => 'color',
			        )
			    ),
			)
		)
	);
	return $section;
}

add_filter( 'royalnews_customizer_theme_option_panel', 'royalnews_customizer_header_category' );