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

function royalnews_customizer_header(){
	$section[ 'header_options' ] = array(
		'title' => esc_html__( 'Header Options', 'royalnews' ),
		'priority'    => 5,
		'fields' => array(
			'header-bg-image' => array(
				'type' => 'image',
				'label' => esc_html__( 'Header Background Image', 'royalnews' ),
				'default'     => '',
				'priority'    => 10,
				'choices'     => array(
					'save_as' => 'array',
				)
			),
			'advertisement-image' => array(
				'type' => 'image',
				'label' => esc_html__( 'Advertisement Image', 'royalnews' ),
				'priority'    => 20,
				'choices'     => array(
					'save_as' => 'array',
				)
			),
			'advertisement-url' => array(
				'type' => 'url',
				'priority'    => 30,
				'label' => esc_html__( 'Advertisement URL', 'royalnews' )
			),
			'enable-search' => array(
				'type' => 'toggle',
				'label' => esc_html__( 'Enable Search', 'royalnews' ),
				'default' => true,
				'priority' => 40,
			),
			'sticky-header' => array(
				'type' => 'toggle',
				'label' => esc_html__( 'Enable Sticky Header', 'royalnews' ),
				'default' => false,
				'priority'    => 50
			),
			'menu-bg-color'    => array(
			    'label' => esc_html__( 'Background Color', 'royalnews' ),
			    'type'  => 'color',
			    'default'   => '#000000',
			    'priority'    => 60,
			    'output' => array(
			        array(
			            'element'  => '.royalnews-primary-menu-wrapper, .royalnews-primary-menu-wrapper .royalnews-menu-wrapper .royalnews-primary-menu > ul > li ul',
			            'property' => 'background',
			        )
			    ),
			),
			'menu-text-color'    => array(
			    'label' => esc_html__( 'Text Color', 'royalnews' ),
			    'type'  => 'color',
			    'default'   => '#ffffff',
			    'priority'    => 70,
			    'output' => array(
			        array(
			            'element'  => '.royalnews-primary-menu-wrapper .royalnews-menu-wrapper .royalnews-primary-menu > ul > li a, .royalnews-primary-menu-wrapper .royalnews-menu-wrapper .royalnews-primary-menu > ul > li ul li a',
			            'property' => 'color',
			        )
			    ),
			),
			'enable-date-tile' => array(
				'type' => 'toggle',
				'label' => esc_html__( 'Enable Date And Time', 'royalnews' ),
				'default' => true,
				'priority' => 80,
			),
			'time-format' => array(
			    'label' => esc_html__( 'Time Format', 'royalnews' ),
			    'type' => 'radio-buttonset',
			    'default' => 'local',
			    'priority' => 90,
			    'choices' => array(
			        'local' => esc_html__( 'Local', 'royalnews' ),
			        'timezone' => esc_html__( 'Timezone', 'royalnews' )
			    ),
			    'active_callback' => array(
			    	array(
			    		'setting'  => 'enable-date-tile',
			    		'operator' => '==',
			    		'value'    => true,
			    	)
			    ),
			),
			'timezone-list' => array(
			    'label' => esc_html__( 'Timezone', 'royalnews' ),
			    'type' => 'select',
			    'default' => '0',
			    'priority' => 100,
			    'search' => true,
			    'choices' => _ROYALNEWS_TIMEZONES,
			    'active_callback' => array(
			    	array(
			    		'setting'  => 'enable-date-tile',
			    		'operator' => '==',
			    		'value'    => true,
			    	),
			    	array(
			    		'setting'  => 'time-format',
			    		'operator' => '==',
			    		'value'    => 'timezone',
			    	)
			    ),
			),
		)
	);
	return $section;
}

add_filter( 'royalnews_customizer_theme_option_panel', 'royalnews_customizer_header' );