<?php

if ( ! function_exists( 'calla_elated_map_general_meta' ) ) {
	function calla_elated_map_general_meta() {
		
		$general_meta_box = calla_elated_create_meta_box(
			array(
				'scope' => apply_filters( 'calla_elated_set_scope_for_meta_boxes', array( 'page', 'post' ), 'general_meta' ),
				'title' => esc_html__( 'General', 'calla' ),
				'name'  => 'general_meta'
			)
		);
		
		/***************** Slider Layout - begin **********************/
		
		calla_elated_create_meta_box_field(
			array(
				'name'        => 'eltdf_page_slider_meta',
				'type'        => 'text',
				'label'       => esc_html__( 'Slider Shortcode', 'calla' ),
				'description' => esc_html__( 'Paste your slider shortcode here', 'calla' ),
				'parent'      => $general_meta_box
			)
		);
		
		/***************** Slider Layout - begin **********************/
		
		/***************** Content Layout - begin **********************/
		
		calla_elated_create_meta_box_field(
			array(
				'name'          => 'eltdf_page_content_behind_header_meta',
				'type'          => 'yesno',
				'default_value' => 'no',
				'label'         => esc_html__( 'Always put content behind header', 'calla' ),
				'description'   => esc_html__( 'Enabling this option will put page content behind page header', 'calla' ),
				'parent'        => $general_meta_box
			)
		);
		
		$eltdf_content_padding_group = calla_elated_add_admin_group(
			array(
				'name'        => 'content_padding_group',
				'title'       => esc_html__( 'Content Style', 'calla' ),
				'description' => esc_html__( 'Define styles for Content area', 'calla' ),
				'parent'      => $general_meta_box
			)
		);
		
			$eltdf_content_padding_row = calla_elated_add_admin_row(
				array(
					'name'   => 'eltdf_content_padding_row',
					'next'   => true,
					'parent' => $eltdf_content_padding_group
				)
			);
		
				calla_elated_create_meta_box_field(
					array(
						'name'   => 'eltdf_page_content_top_padding',
						'type'   => 'textsimple',
						'label'  => esc_html__( 'Content Top Padding', 'calla' ),
						'parent' => $eltdf_content_padding_row,
						'args'   => array(
							'suffix' => 'px'
						)
					)
				);
				
				calla_elated_create_meta_box_field(
					array(
						'name'    => 'eltdf_page_content_top_padding_mobile',
						'type'    => 'selectsimple',
						'label'   => esc_html__( 'Set this top padding for mobile header', 'calla' ),
						'parent'  => $eltdf_content_padding_row,
						'options' => calla_elated_get_yes_no_select_array( false )
					)
				);
		
		calla_elated_create_meta_box_field(
			array(
				'name'        => 'eltdf_page_background_color_meta',
				'type'        => 'color',
				'label'       => esc_html__( 'Page Background Color', 'calla' ),
				'description' => esc_html__( 'Choose background color for page content', 'calla' ),
				'parent'      => $general_meta_box
			)
		);
		
		/***************** Content Layout - end **********************/
		
		/***************** Boxed Layout - begin **********************/
		
		calla_elated_create_meta_box_field(
			array(
				'name'    => 'eltdf_boxed_meta',
				'type'    => 'select',
				'label'   => esc_html__( 'Boxed Layout', 'calla' ),
				'parent'  => $general_meta_box,
				'options' => calla_elated_get_yes_no_select_array()
			)
		);
		
			$boxed_container_meta = calla_elated_add_admin_container(
				array(
					'parent'          => $general_meta_box,
					'name'            => 'boxed_container_meta',
					'dependency' => array(
						'hide' => array(
							'eltdf_boxed_meta'  => array('','no')
						)
					)
				)
			);
		
				calla_elated_create_meta_box_field(
					array(
						'name'        => 'eltdf_page_background_color_in_box_meta',
						'type'        => 'color',
						'label'       => esc_html__( 'Page Background Color', 'calla' ),
						'description' => esc_html__( 'Choose the page background color outside box', 'calla' ),
						'parent'      => $boxed_container_meta
					)
				);
				
				calla_elated_create_meta_box_field(
					array(
						'name'        => 'eltdf_boxed_background_image_meta',
						'type'        => 'image',
						'label'       => esc_html__( 'Background Image', 'calla' ),
						'description' => esc_html__( 'Choose an image to be displayed in background', 'calla' ),
						'parent'      => $boxed_container_meta
					)
				);
				
				calla_elated_create_meta_box_field(
					array(
						'name'        => 'eltdf_boxed_pattern_background_image_meta',
						'type'        => 'image',
						'label'       => esc_html__( 'Background Pattern', 'calla' ),
						'description' => esc_html__( 'Choose an image to be used as background pattern', 'calla' ),
						'parent'      => $boxed_container_meta
					)
				);
				
				calla_elated_create_meta_box_field(
					array(
						'name'          => 'eltdf_boxed_background_image_attachment_meta',
						'type'          => 'select',
						'default_value' => 'fixed',
						'label'         => esc_html__( 'Background Image Attachment', 'calla' ),
						'description'   => esc_html__( 'Choose background image attachment', 'calla' ),
						'parent'        => $boxed_container_meta,
						'options'       => array(
							''       => esc_html__( 'Default', 'calla' ),
							'fixed'  => esc_html__( 'Fixed', 'calla' ),
							'scroll' => esc_html__( 'Scroll', 'calla' )
						)
					)
				);
		
		/***************** Boxed Layout - end **********************/
		
		/***************** Passepartout Layout - begin **********************/
		
		calla_elated_create_meta_box_field(
			array(
				'name'          => 'eltdf_paspartu_meta',
				'type'          => 'select',
				'default_value' => '',
				'label'         => esc_html__( 'Passepartout', 'calla' ),
				'description'   => esc_html__( 'Enabling this option will display passepartout around site content', 'calla' ),
				'parent'        => $general_meta_box,
				'options'       => calla_elated_get_yes_no_select_array(),
			)
		);
		
			$paspartu_container_meta = calla_elated_add_admin_container(
				array(
					'parent'          => $general_meta_box,
					'name'            => 'eltdf_paspartu_container_meta',
					'dependency' => array(
						'hide' => array(
							'eltdf_paspartu_meta'  => array('','no')
						)
					)
				)
			);
		
				calla_elated_create_meta_box_field(
					array(
						'name'        => 'eltdf_paspartu_color_meta',
						'type'        => 'color',
						'label'       => esc_html__( 'Passepartout Color', 'calla' ),
						'description' => esc_html__( 'Choose passepartout color, default value is #ffffff', 'calla' ),
						'parent'      => $paspartu_container_meta
					)
				);
				
				calla_elated_create_meta_box_field(
					array(
						'name'        => 'eltdf_paspartu_width_meta',
						'type'        => 'text',
						'label'       => esc_html__( 'Passepartout Size', 'calla' ),
						'description' => esc_html__( 'Enter size amount for passepartout', 'calla' ),
						'parent'      => $paspartu_container_meta,
						'args'        => array(
							'col_width' => 2,
							'suffix'    => 'px or %'
						)
					)
				);
		
				calla_elated_create_meta_box_field(
					array(
						'name'        => 'eltdf_paspartu_responsive_width_meta',
						'type'        => 'text',
						'label'       => esc_html__( 'Responsive Passepartout Size', 'calla' ),
						'description' => esc_html__( 'Enter size amount for passepartout for smaller screens (tablets and mobiles view)', 'calla' ),
						'parent'      => $paspartu_container_meta,
						'args'        => array(
							'col_width' => 2,
							'suffix'    => 'px or %'
						)
					)
				);
				
				calla_elated_create_meta_box_field(
					array(
						'parent'        => $paspartu_container_meta,
						'type'          => 'select',
						'default_value' => '',
						'name'          => 'eltdf_disable_top_paspartu_meta',
						'label'         => esc_html__( 'Disable Top Passepartout', 'calla' ),
						'options'       => calla_elated_get_yes_no_select_array(),
					)
				);
		
				calla_elated_create_meta_box_field(
					array(
						'parent'        => $paspartu_container_meta,
						'type'          => 'select',
						'default_value' => '',
						'name'          => 'eltdf_enable_fixed_paspartu_meta',
						'label'         => esc_html__( 'Enable Fixed Passepartout', 'calla' ),
						'description'   => esc_html__( 'Enabling this option will set fixed passepartout for your screens', 'calla' ),
						'options'       => calla_elated_get_yes_no_select_array(),
					)
				);
		
		/***************** Passepartout Layout - end **********************/
		
		/***************** Content Width Layout - begin **********************/
		
		calla_elated_create_meta_box_field(
			array(
				'name'          => 'eltdf_initial_content_width_meta',
				'type'          => 'select',
				'default_value' => '',
				'label'         => esc_html__( 'Initial Width of Content', 'calla' ),
				'description'   => esc_html__( 'Choose the initial width of content which is in grid (Applies to pages set to "Default Template" and rows set to "In Grid")', 'calla' ),
				'parent'        => $general_meta_box,
				'options'       => array(
					''                => esc_html__( 'Default', 'calla' ),
					'eltdf-grid-1100' => esc_html__( '1100px', 'calla' ),
					'eltdf-grid-1300' => esc_html__( '1300px', 'calla' ),
					'eltdf-grid-1200' => esc_html__( '1200px', 'calla' ),
					'eltdf-grid-1000' => esc_html__( '1000px', 'calla' ),
					'eltdf-grid-800'  => esc_html__( '800px', 'calla' )
				)
			)
		);
		
		/***************** Content Width Layout - end **********************/
		
		/***************** Smooth Page Transitions Layout - begin **********************/
		
		calla_elated_create_meta_box_field(
			array(
				'name'          => 'eltdf_smooth_page_transitions_meta',
				'type'          => 'select',
				'default_value' => '',
				'label'         => esc_html__( 'Smooth Page Transitions', 'calla' ),
				'description'   => esc_html__( 'Enabling this option will perform a smooth transition between pages when clicking on links', 'calla' ),
				'parent'        => $general_meta_box,
				'options'       => calla_elated_get_yes_no_select_array()
			)
		);
		
			$page_transitions_container_meta = calla_elated_add_admin_container(
				array(
					'parent'          => $general_meta_box,
					'name'            => 'page_transitions_container_meta',
					'dependency' => array(
						'hide' => array(
							'eltdf_smooth_page_transitions_meta'  => array('','no')
						)
					)
				)
			);
		
				calla_elated_create_meta_box_field(
					array(
						'name'        => 'eltdf_page_transition_preloader_meta',
						'type'        => 'select',
						'label'       => esc_html__( 'Enable Preloading Animation', 'calla' ),
						'description' => esc_html__( 'Enabling this option will display an animated preloader while the page content is loading', 'calla' ),
						'parent'      => $page_transitions_container_meta,
						'options'     => calla_elated_get_yes_no_select_array()
					)
				);
				
				$page_transition_preloader_container_meta = calla_elated_add_admin_container(
					array(
						'parent'          => $page_transitions_container_meta,
						'name'            => 'page_transition_preloader_container_meta',
						'dependency' => array(
							'hide' => array(
								'eltdf_page_transition_preloader_meta'  => array('','no')
							)
						)
					)
				);
				
					calla_elated_create_meta_box_field(
						array(
							'name'   => 'eltdf_smooth_pt_bgnd_color_meta',
							'type'   => 'color',
							'label'  => esc_html__( 'Page Loader Background Color', 'calla' ),
							'parent' => $page_transition_preloader_container_meta
						)
					);
					
					$group_pt_spinner_animation_meta = calla_elated_add_admin_group(
						array(
							'name'        => 'group_pt_spinner_animation_meta',
							'title'       => esc_html__( 'Loader Style', 'calla' ),
							'description' => esc_html__( 'Define styles for loader spinner animation', 'calla' ),
							'parent'      => $page_transition_preloader_container_meta
						)
					);
					
					$row_pt_spinner_animation_meta = calla_elated_add_admin_row(
						array(
							'name'   => 'row_pt_spinner_animation_meta',
							'parent' => $group_pt_spinner_animation_meta
						)
					);
					
					calla_elated_create_meta_box_field(
						array(
							'type'    => 'selectsimple',
							'name'    => 'eltdf_smooth_pt_spinner_type_meta',
							'label'   => esc_html__( 'Spinner Type', 'calla' ),
							'parent'  => $row_pt_spinner_animation_meta,
							'options' => array(
								''                      => esc_html__( 'Default', 'calla' ),
                                'calla'        			=> esc_html__( 'Calla', 'calla' ),
								'rotate_circles'        => esc_html__( 'Rotate Circles', 'calla' ),
								'pulse'                 => esc_html__( 'Pulse', 'calla' ),
								'double_pulse'          => esc_html__( 'Double Pulse', 'calla' ),
								'cube'                  => esc_html__( 'Cube', 'calla' ),
								'rotating_cubes'        => esc_html__( 'Rotating Cubes', 'calla' ),
								'stripes'               => esc_html__( 'Stripes', 'calla' ),
								'wave'                  => esc_html__( 'Wave', 'calla' ),
								'two_rotating_circles'  => esc_html__( '2 Rotating Circles', 'calla' ),
								'five_rotating_circles' => esc_html__( '5 Rotating Circles', 'calla' ),
								'atom'                  => esc_html__( 'Atom', 'calla' ),
								'clock'                 => esc_html__( 'Clock', 'calla' ),
								'mitosis'               => esc_html__( 'Mitosis', 'calla' ),
								'lines'                 => esc_html__( 'Lines', 'calla' ),
								'fussion'               => esc_html__( 'Fussion', 'calla' ),
								'wave_circles'          => esc_html__( 'Wave Circles', 'calla' ),
								'pulse_circles'         => esc_html__( 'Pulse Circles', 'calla' )
							)
						)
					);
					
					calla_elated_create_meta_box_field(
						array(
							'type'   => 'colorsimple',
							'name'   => 'eltdf_smooth_pt_spinner_color_meta',
							'label'  => esc_html__( 'Spinner Color', 'calla' ),
							'parent' => $row_pt_spinner_animation_meta
						)
					);
					
					calla_elated_create_meta_box_field(
						array(
							'name'        => 'eltdf_page_transition_fadeout_meta',
							'type'        => 'select',
							'label'       => esc_html__( 'Enable Fade Out Animation', 'calla' ),
							'description' => esc_html__( 'Enabling this option will turn on fade out animation when leaving page', 'calla' ),
							'options'     => calla_elated_get_yes_no_select_array(),
							'parent'      => $page_transitions_container_meta
						
						)
					);
		
		/***************** Smooth Page Transitions Layout - end **********************/
		
		/***************** Comments Layout - begin **********************/
		
		calla_elated_create_meta_box_field(
			array(
				'name'        => 'eltdf_page_comments_meta',
				'type'        => 'select',
				'label'       => esc_html__( 'Show Comments', 'calla' ),
				'description' => esc_html__( 'Enabling this option will show comments on your page', 'calla' ),
				'parent'      => $general_meta_box,
				'options'     => calla_elated_get_yes_no_select_array()
			)
		);
		
		/***************** Comments Layout - end **********************/
	}
	
	add_action( 'calla_elated_meta_boxes_map', 'calla_elated_map_general_meta', 10 );
}