<?php if ( ! defined( 'FW' ) ) {
	die( 'Forbidden' );
}

$optionimage = get_template_directory_uri() . '/assets/img/options/';

$args = array(
	'hide_empty' => 1
);
$posttags = get_tags($args);
$choices = array();
if($posttags){
	foreach($posttags as $tag) {
		$choices[$tag->term_id] = $tag->name.' ('.$tag->count.')';
	}
}

$slidearray = array(
	'wideslider' => array(
		'small' => array(
			'height' => 80,
			'src'    => $optionimage . '2.jpg'
		)
	),
	'wishbonecarousel' => array(
		'small' => array(
			'height' => 80,
			'src'    => $optionimage . '1.jpg'
		)
	),
	'grid' => array(
		'small' => array(
			'height' => 80,
			'src'    => $optionimage . '3.jpg'
		)
	),
	'twocol' => array(
		'small' => array(
			'height' => 80,
			'src'    => $optionimage . '4.jpg'
		)
	),
	'onecol' => array(
		'small' => array(
			'height' => 80,
			'src'    => $optionimage . '5.jpg'
		)
	),
);

$postlayoutchoice = array(
	'type'    => 'radio',
	'label'   => esc_html__( 'Post Layout', 'jt-wishbone' ),
	'choices' => array(
		'default' => esc_html__( 'Default', 'jt-wishbone' ),
		'masonry' => esc_html__( 'Masonry', 'jt-wishbone' ),
		'simplegrid' => esc_html__( 'Simple Grid', 'jt-wishbone' ),
		'classic' => esc_html__( 'Classic', 'jt-wishbone' ),
		'simplelist' => esc_html__( 'Simple List (without post thumbnail)', 'jt-wishbone' ),
	)
); // home-post-layout

$sidebarchoice = array(
	'right-sidebar' => array(
		'small' => array(
			'height' => 70,
			'src'    => get_template_directory_uri() . '/assets/img/sidebar/right.png'
		)
	),
	'left-sidebar' => array(
		'small' => array(
			'height' => 70,
			'src'    => get_template_directory_uri() . '/assets/img/sidebar/left.png'
		)
	),
	'no-sidebar' => array(
		'small' => array(
			'height' => 70,
			'src'    => get_template_directory_uri() . '/assets/img/sidebar/nosidebar.png'
		)
	),
); //choices


$options = array(
	'template' => array(
		'title'   => esc_html__( 'Page Layouts', 'jt-wishbone' ),
		'type'    => 'tab',
		'options' => array(
			/* INDEX */
			'index-layout' => array(
				'title'   => esc_html__( 'Index', 'jt-wishbone' ),
				'type'    => 'tab',
				'options' => array(

					'index_sliderbox' => array(
						'title'   => 'Hero Section',
						'type'    => 'box',
						'options' => array(
							'index_slider_group' => array(
								'title'   => 'Slider Setting',
								'type'    => 'group',
								'options' => array(
									'index_showslider' => array(
										'type'  => 'switch',
										'label' => esc_html__( 'Hero Section?', 'jt-wishbone' ),
									),

									'index_home-slide-type' => array(
										'label'   => esc_html__( 'Hero Section', 'jt-wishbone' ),
										'type'	=> 'image-picker',
										'desc'	=> esc_html__( 'As known as Slideshow, headline section, etc', 'jt-wishbone' ),
										'choices' => $slidearray,
									),

									/**
									 * Slider Setting
									 * id: fetchnumb
									 */
									'index_fetchnumb'  => array(
										'type'  => 'text',
										'label' => esc_html__( 'Fetch Number', 'jt-wishbone' ),
										'desc' => esc_html__( 'How many posts?', 'jt-wishbone' ),
									),

									/**
									 * Slider Setting
									 * id: demo_group_multi_select
									 */
									'index_slider_tags' => array(
										'type'       => 'multi-select',
										'label'      => esc_html__( 'Posts tagged under:', 'jt-wishbone' ),
										'desc'      => esc_html__( 'Make sure each posts have their featured image', 'jt-wishbone' ),
										'choices' => $choices
									),
								),
							), // index_slider_group
						),
					),

					'index_template_group' => array(
						'title'   => 'Content Layout',
						'type'    => 'box',
						'options' => array(
							'index_home-post-layout' => $postlayoutchoice,

							/**
							 * Post Layout
							 * id: homesidebar
							 */
							'index_homesidebar' => array(
								'label'	=> esc_html__( 'Sidebar Position', 'jt-wishbone' ),
								'type'	=> 'image-picker',
								'value'	=> 'right-sidebar',
								'desc'	=> esc_html__( 'The sidebar position, default is right', 'jt-wishbone' ),
								'choices' => $sidebarchoice,
							), //homesidebar
						),
					),

					'paging' => array(
						'title'   => 'Paging Type',
						'type'    => 'box',
						'options' => array(
							'pagingtype' => array(
								'type'    => 'select',
								'label'   => esc_html__( 'Pagination Type', 'jt-wishbone' ),
								'choices' => array(
									'loadmore' => esc_html__( 'AJAX Load More', 'jt-wishbone' ),
									'numbered' => esc_html__( 'Numbered', 'jt-wishbone' ),
									'nextprev' => esc_html__( 'Next & Prev', 'jt-wishbone' ),
								)
							), //pagingtype
						),
					),
				),
			),

			/* Single.php */
			'single-layout' => array(
				'title'   => esc_html__( 'Post Page', 'jt-wishbone' ),
				'type'    => 'tab',
				'options' => array(
					'single_sliderbox' => array(
						'title'   => 'Post Page',
						'type'    => 'box',
						'options' => array(
							'single_template_group' => array(
								'title'   => 'Template Setting',
								'type'    => 'group',
								'options' => array(

									/**
									 * Post Layout
									 * id: homesidebar
									 */
									'single_homesidebar' => array(
										'label'	=> esc_html__( 'Sidebar Position', 'jt-wishbone' ),
										'type'	=> 'image-picker',
										'value'	=> 'right-sidebar',
										'desc'	=> esc_html__( 'The sidebar position, default is right', 'jt-wishbone' ),
										'choices' => $sidebarchoice, //choices
									), //homesidebar

									'postsharing' => array(
										'type'  => 'switch',
										'value'  => true,
										'label' => esc_html__( 'Post Share Buttons', 'jt-wishbone' ),
									),
									'postnextprev' => array(
										'type'  => 'switch',
										'value'  => true,
										'label' => esc_html__( 'Prev and Next Post', 'jt-wishbone' ),
									),
									'authorinfo' => array(
										'type'  => 'switch',
										'value'  => true,
										'label' => esc_html__( 'Author Info', 'jt-wishbone' ),
									),
									'relatedposts' => array(
										'type'  => 'switch',
										'value'  => true,
										'label' => esc_html__( 'Related Posts', 'jt-wishbone' ),
										'desc' => esc_html__( 'Check also post will be affected by this option', 'jt-wishbone' ),
									),
								),
							),
						),
					),
				),
			), //SINGLE.php

			/* page.php */
			'page-layout' => array(
				'title'   => esc_html__( 'Plain Page', 'jt-wishbone' ),
				'type'    => 'tab',
				'options' => array(
					'page_sliderbox' => array(
						'title'   => 'Page Setting',
						'type'    => 'box',
						'options' => array(
							'page_template_group' => array(
								'title'   => 'Page Setting',
								'type'    => 'group',
								'options' => array(

									/**
									 * Post Layout
									 * id: homesidebar
									 */
									'page_homesidebar' => array(
										'label'	=> esc_html__( 'Sidebar Position', 'jt-wishbone' ),
										'type'	=> 'image-picker',
										'value'	=> 'right-sidebar',
										'desc'	=> esc_html__( 'The sidebar position, default is right. This option will affects to default page template only.', 'jt-wishbone' ),
										'choices' => $sidebarchoice, //choices
									), //homesidebar
								),
							),
						),
					),
				),
			), //page.php

			/* ARCHIVES.php */
			'archives-layout' => array(
				'title'   => esc_html__( 'Archives', 'jt-wishbone' ),
				'type'    => 'tab',
				'options' => array(
					'archives_sliderbox' => array(
						'title'   => 'Archives Setting',
						'type'    => 'group',
						'options' => array(
							'archives_slider_group' => array(
								'title'   => 'Hero Section',
								'type'    => 'box',
								'options' => array(
									'archives_showslider' => array(
										'type'  => 'switch',
										'label' => esc_html__( 'Hero Section?', 'jt-wishbone' ),
									),

									'archives_home-slide-type' => array(
										'label'   => esc_html__( 'Hero Section', 'jt-wishbone' ),
										'type'	=> 'image-picker',
										'desc'	=> esc_html__( 'As known as Slideshow, headline section, etc', 'jt-wishbone' ),
										'choices' => $slidearray,
									),

									/**
									 * Slider Setting
									 * id: fetchnumb
									 */
									'archives_fetchnumb'  => array(
										'type'  => 'text',
										'label' => esc_html__( 'Fetch Number', 'jt-wishbone' ),
										'desc' => esc_html__( 'How many posts?', 'jt-wishbone' ),
									),

									/**
									 * Slider Setting
									 * id: demo_group_multi_select
									 */
									'archives_slider_tags' => array(
										'type'       => 'multi-select',
										'label'      => esc_html__( 'Posts tagged under:', 'jt-wishbone' ),
										'choices' => $choices,
										'desc'       => '',
										'help'       => '',
									),
								),
							), // index_slider_group


							'archives_template_group' => array(
								'title'   => 'Content Layout',
								'type'    => 'box',
								'options' => array(
									'archives_home-post-layout' => $postlayoutchoice, // home-post-layout
									'archives_homesidebar' => array(
										'label'	=> esc_html__( 'Sidebar Position', 'jt-wishbone' ),
										'type'	=> 'image-picker',
										'value'	=> 'right-sidebar',
										'desc'	=> esc_html__( 'The sidebar position, default is right', 'jt-wishbone' ),
										'choices' => $sidebarchoice, //choices
									), //homesidebar
								),
							),
						),
					),
				),
			), //ARCHIVES.php

			/* AUTHOR.php */
			'author_layout' => array(
				'title'   => esc_html__( 'Author', 'jt-wishbone' ),
				'type'    => 'tab',
				'options' => array(
					'author_sliderbox' => array(
						'title'   => 'Author Setting',
						'type'    => 'group',
						'options' => array(
							'author_slider_group' => array(
								'title'   => 'Hero Section',
								'type'    => 'box',
								'options' => array(
									'author_showslider' => array(
										'type'  => 'switch',
										'label' => esc_html__( 'Hero Section?', 'jt-wishbone' ),
									),

									'author_home-slide-type' => array(
										'label'   => esc_html__( 'Hero Section', 'jt-wishbone' ),
										'type'	=> 'image-picker',
										'desc'	=> esc_html__( 'As known as Slideshow, headline section, etc', 'jt-wishbone' ),
										'choices' => $slidearray,
									),

									/**
									 * Slider Setting
									 * id: fetchnumb
									 */
									'author_fetchnumb'  => array(
										'type'  => 'text',
										'label' => esc_html__( 'Fetch Number', 'jt-wishbone' ),
										'desc' => esc_html__( 'How many posts?', 'jt-wishbone' ),
									),

									/**
									 * Slider Setting
									 * id: demo_group_multi_select
									 */
									'author_slider_tags' => array(
										'type'       => 'multi-select',
										'label'      => esc_html__( 'Posts tagged under:', 'jt-wishbone' ),
										'choices' => $choices,
										'desc'       => '',
										'help'       => '',
									),
								),
							), // index_slider_group


							'author_template_group' => array(
								'title'   => 'Content Layout',
								'type'    => 'box',
								'options' => array(
									'author_home-post-layout' => $postlayoutchoice, //author_home-layout
									'author_homesidebar' => array(
										'label'	=> esc_html__( 'Sidebar Position', 'jt-wishbone' ),
										'type'	=> 'image-picker',
										'value'	=> 'right-sidebar',
										'desc'	=> esc_html__( 'The sidebar position, default is right', 'jt-wishbone' ),
										'choices' => $sidebarchoice, //choices
									), //homesidebar
								),
							),
						),
					),
				),
			), //AUTHOR.php

			/* CATEGORY.php */
			'category_layout' => array(
				'title'   => esc_html__( 'Category', 'jt-wishbone' ),
				'type'    => 'tab',
				'options' => array(
					'category_sliderbox' => array(
						'title'   => 'Category Setting',
						'type'    => 'group',
						'options' => array(
							'category_slider_group' => array(
								'title'   => 'Hero Section',
								'type'    => 'box',
								'options' => array(
									'category_showslider' => array(
										'type'  => 'switch',
										'label' => esc_html__( 'Hero Section?', 'jt-wishbone' ),
									),

									'category_home-slide-type' => array(
										'label'   => esc_html__( 'Hero Section', 'jt-wishbone' ),
										'type'	=> 'image-picker',
										'desc'	=> esc_html__( 'As known as Slideshow, headline section, etc', 'jt-wishbone' ),
										'choices' => $slidearray,
									),

									/**
									 * Slider Setting
									 * id: fetchnumb
									 */
									'category_fetchnumb'  => array(
										'type'  => 'text',
										'label' => esc_html__( 'Fetch Number', 'jt-wishbone' ),
										'desc' => esc_html__( 'How many posts?', 'jt-wishbone' ),
									),

									/**
									 * Slider Setting
									 * id: demo_group_multi_select
									 */
									'category_slider_tags' => array(
										'type'       => 'multi-select',
										'label'      => esc_html__( 'Posts tagged under:', 'jt-wishbone' ),
										'choices' => $choices,
										'desc'       => '',
										'help'       => '',
									),
								),
							), // index_slider_group


							'category_template_group' => array(
								'title'   => 'Content Layout',
								'type'    => 'box',
								'options' => array(
									'category_home-post-layout' => $postlayoutchoice, // home-post-layout

									/**
									 * Post Layout
									 * id: homesidebar
									 */
									'category_homesidebar' => array(
										'label'	=> esc_html__( 'Sidebar Position', 'jt-wishbone' ),
										'type'	=> 'image-picker',
										'value'	=> 'right-sidebar',
										'desc'	=> esc_html__( 'The sidebar position, default is right', 'jt-wishbone' ),
										'choices' => $sidebarchoice, //choices
									), //homesidebar
								),
							),
						),
					),
				),
			),//CATEGORY.php

			/* SEARCH.php */
			'search_layout' => array(
				'title'   => esc_html__( 'Search', 'jt-wishbone' ),
				'type'    => 'tab',
				'options' => array(
					'search_sliderbox' => array(
						'title'   => 'Search Setting',
						'type'    => 'group',
						'options' => array(
							'search_slider_group' => array(
								'title'   => 'Hero Section',
								'type'    => 'box',
								'options' => array(
									'search_showslider' => array(
										'type'  => 'switch',
										'label' => esc_html__( 'Hero Section?', 'jt-wishbone' ),
									),

									'search_home-slide-type' => array(
										'label'   => esc_html__( 'Hero Section', 'jt-wishbone' ),
										'type'	=> 'image-picker',
										'desc'	=> esc_html__( 'As known as Slideshow, headline section, etc', 'jt-wishbone' ),
										'choices' => $slidearray,
									),

									/**
									 * Slider Setting
									 * id: fetchnumb
									 */
									'search_fetchnumb'  => array(
										'type'  => 'text',
										'label' => esc_html__( 'Fetch Number', 'jt-wishbone' ),
										'desc' => esc_html__( 'How many posts?', 'jt-wishbone' ),
									),

									/**
									 * Slider Setting
									 * id: demo_group_multi_select
									 */
									'search_slider_tags' => array(
										'type'       => 'multi-select',
										'label'      => esc_html__( 'Posts tagged under:', 'jt-wishbone' ),
										'choices' => $choices,
										'desc'       => '',
										'help'       => '',
									),
								),
							), // index_slider_group


							'search_template_group' => array(
								'title'   => 'Content Layout',
								'type'    => 'box',
								'options' => array(
									'search_home-post-layout' => $postlayoutchoice, // home-post-layout

									/**
									 * Post Layout
									 * id: homesidebar
									 */
									'search_homesidebar' => array(
										'label'	=> esc_html__( 'Sidebar Position', 'jt-wishbone' ),
										'type'	=> 'image-picker',
										'value'	=> 'right-sidebar',
										'desc'	=> esc_html__( 'The sidebar position, default is right', 'jt-wishbone' ),
										'choices' => $sidebarchoice, //choices
									), //homesidebar
								),
							),
						),
					),
				),
			), //SEARCH.php

			/* TAG.php */
			'tag_layout' => array(
				'title'   => esc_html__( 'Tag', 'jt-wishbone' ),
				'type'    => 'tab',
				'options' => array(
					'tag_sliderbox' => array(
						'title'   => 'Tag Setting',
						'type'    => 'box',
						'options' => array(
							'tag_slider_group' => array(
								'title'   => 'Slider Setting',
								'type'    => 'group',
								'options' => array(
									'tag_showslider' => array(
										'type'  => 'switch',
										'label' => esc_html__( 'Hero Section?', 'jt-wishbone' ),
									),

									'tag_home-slide-type' => array(
										'label'   => esc_html__( 'Hero Section', 'jt-wishbone' ),
										'type'	=> 'image-picker',
										'desc'	=> esc_html__( 'As known as Slideshow, headline section, etc', 'jt-wishbone' ),
										'choices' => $slidearray,
									),

									/**
									 * Slider Setting
									 * id: fetchnumb
									 */
									'tag_fetchnumb'  => array(
										'type'  => 'text',
										'label' => esc_html__( 'Fetch Number', 'jt-wishbone' ),
										'desc' => esc_html__( 'How many posts?', 'jt-wishbone' ),
									),

									/**
									 * Slider Setting
									 * id: demo_group_multi_select
									 */
									'tag_slider_tags' => array(
										'type'       => 'multi-select',
										'label'      => esc_html__( 'Posts tagged under:', 'jt-wishbone' ),
										'choices' => $choices,
										'desc'       => '',
										'help'       => '',
									),
								),
							), // index_slider_group


							'tag_template_group' => array(
								'title'   => 'Template Setting',
								'type'    => 'group',
								'options' => array(
									'tag_home-post-layout' => $postlayoutchoice, // home-post-layout

									/**
									 * Post Layout
									 * id: homesidebar
									 */
									'tag_homesidebar' => array(
										'label'	=> esc_html__( 'Sidebar Position', 'jt-wishbone' ),
										'type'	=> 'image-picker',
										'value'	=> 'right-sidebar',
										'desc'	=> esc_html__( 'The sidebar position, default is right', 'jt-wishbone' ),
										'choices' => $sidebarchoice, //choices
									), //homesidebar
								),
							),
						),
					),
				),
			), //TAG.php

			/* 404.php */
			'404-layout' => array(
				'title'   => esc_html__( '404', 'jt-wishbone' ),
				'type'    => 'tab',
				'options' => array(
					'404_sliderbox' => array(
						'title'   => '404 Setting',
						'type'    => 'box',
						'options' => array(
							'404_template_group' => array(
								'title'   => 'Template Setting',
								'type'    => 'group',
								'options' => array(

									/**
									 * Post Layout
									 * id: homesidebar
									 */
									'404_homesidebar' => array(
										'label'	=> esc_html__( 'Sidebar Position', 'jt-wishbone' ),
										'type'	=> 'image-picker',
										'value'	=> 'right-sidebar',
										'desc'	=> esc_html__( 'The sidebar position, default is right', 'jt-wishbone' ),
										'choices' => array(
											'no-sidebar' => array(
												'small' => array(
													'height' => 70,
													'src'    => get_template_directory_uri() . '/assets/img/sidebar/nosidebar.png'
												)
											),
											'right-sidebar' => array(
												'small' => array(
													'height' => 70,
													'src'    => get_template_directory_uri() . '/assets/img/sidebar/right.png'
												)
											),
											'left-sidebar' => array(
												'small' => array(
													'height' => 70,
													'src'    => get_template_directory_uri() . '/assets/img/sidebar/left.png'
												)
											)
										), //choices
									), //homesidebar
									'wishbonenotfoundtitle' => array(
									    'type'  => 'text',
									    'label' => esc_html__('404/Not Found Title', 'jt-wishbone'),
									    'desc' => esc_html__('Customize the not found headline', 'jt-wishbone'),
									),
									'wishbonenotfoundtitlemessage' => array(
										'label' => esc_html__( '404/Not Found Message', 'jt-wishbone' ),
										'type'  => 'wp-editor',
										'desc'  => esc_html__( 'If you\'d like to write custom message, write it here.', 'jt-wishbone' ),
										'reinit' => true,
									),
								),
							),
						),
					),
				),
			), //404.php
		)
	)
);
