<?php
/**
 * Config file for theme options
 * @since 1.0
 * @package evaWp
 */

if( !class_exists( 'Kirki' ) ){
	return;
}

if( !function_exists( 'evawp_options_dir_path' ) ){
	/**
	 * Returns path for options
	 * @since 1.0
	 * @package evaWp
	 */
	function evawp_options_dir_path( $file, $dir = 'general' ){
		$general_path = 'theme-options/general-options/';
		$front_page_path = 'theme-options/front-page-options/';
		$goto_pro_path = 'theme-options/goto-pro/';

		if( 'general' == $dir ){
			$path = $general_path . $file;
		}elseif( 'front_page' == $dir ){
			$path = $front_page_path . $file;
		}elseif( 'goto-pro' == $dir ){
			$path = $goto_pro_path . $file;
		}

		return $path . '-options';
	}

}

Kirki::add_config( 'evawp_theme_config', array(
	'capability'    => 'edit_theme_options',
	'option_type'   => 'theme_mod',
));

$panels = array(
	'general_options' => array(
		'title'       => esc_html__( 'General Options', 'evawp' ),
		'priority' => 1
	),
	'front_page_options' => array(
		'title'       => esc_html__( 'Front Page Options', 'evawp' ),
		'priority' => 3
	)
);

foreach ( $panels as $key => $panel ) {
	evawp_add_panel(array(
		'id' => $key,
		'title' => $panel[ 'title' ],
		'priority'    => $panel[ 'priority' ],
	));
}


/**
 * Needed Files for theme options
 * @since 1.0
 * @package evaWp
 */
evawp_file_loader( array(
	evawp_options_dir_path( 'sidebar' ),
	evawp_options_dir_path( 'color' ),
	evawp_options_dir_path( 'breadcrumb' ),
	evawp_options_dir_path( 'post' ),
	evawp_options_dir_path( 'scroll-to-top' ),
	evawp_options_dir_path( 'site' ),
	evawp_options_dir_path( 'footer' ),
	evawp_options_dir_path( 'slider', 'front_page' ),
	evawp_options_dir_path( 'goto-pro', 'goto-pro' )
));