<?php

/*** Post Settings ***/

if ( ! function_exists( 'calla_elated_map_post_meta' ) ) {
	function calla_elated_map_post_meta() {
		
		$post_meta_box = calla_elated_create_meta_box(
			array(
				'scope' => array( 'post' ),
				'title' => esc_html__( 'Post', 'calla' ),
				'name'  => 'post-meta'
			)
		);
		
		calla_elated_create_meta_box_field(
			array(
				'name'          => 'eltdf_blog_single_sidebar_layout_meta',
				'type'          => 'select',
				'label'         => esc_html__( 'Sidebar Layout', 'calla' ),
				'description'   => esc_html__( 'Choose a sidebar layout for Blog single page', 'calla' ),
				'default_value' => '',
				'parent'        => $post_meta_box,
                'options'       => calla_elated_get_custom_sidebars_options( true )
			)
		);
		
		$calla_custom_sidebars = calla_elated_get_custom_sidebars();
		if ( count( $calla_custom_sidebars ) > 0 ) {
			calla_elated_create_meta_box_field( array(
				'name'        => 'eltdf_blog_single_custom_sidebar_area_meta',
				'type'        => 'selectblank',
				'label'       => esc_html__( 'Sidebar to Display', 'calla' ),
				'description' => esc_html__( 'Choose a sidebar to display on Blog single page. Default sidebar is "Sidebar"', 'calla' ),
				'parent'      => $post_meta_box,
				'options'     => calla_elated_get_custom_sidebars(),
				'args' => array(
					'select2' => true
				)
			) );
		}
		
		calla_elated_create_meta_box_field(
			array(
				'name'        => 'eltdf_blog_list_featured_image_meta',
				'type'        => 'image',
				'label'       => esc_html__( 'Blog List Image', 'calla' ),
				'description' => esc_html__( 'Choose an Image for displaying in blog list. If not uploaded, featured image will be shown.', 'calla' ),
				'parent'      => $post_meta_box
			)
		);
		
		calla_elated_create_meta_box_field(
			array(
				'name'          => 'eltdf_blog_masonry_gallery_fixed_dimensions_meta',
				'type'          => 'select',
				'label'         => esc_html__( 'Dimensions for Fixed Proportion', 'calla' ),
				'description'   => esc_html__( 'Choose image layout when it appears in Masonry lists in fixed proportion', 'calla' ),
				'default_value' => 'default',
				'parent'        => $post_meta_box,
				'options'       => array(
					'default'            => esc_html__( 'Default', 'calla' ),
					'large-width'        => esc_html__( 'Large Width', 'calla' ),
					'large-height'       => esc_html__( 'Large Height', 'calla' ),
					'large-width-height' => esc_html__( 'Large Width/Height', 'calla' )
				)
			)
		);
		
		calla_elated_create_meta_box_field(
			array(
				'name'          => 'eltdf_blog_masonry_gallery_original_dimensions_meta',
				'type'          => 'select',
				'label'         => esc_html__( 'Dimensions for Original Proportion', 'calla' ),
				'description'   => esc_html__( 'Choose image layout when it appears in Masonry lists in original proportion', 'calla' ),
				'default_value' => 'default',
				'parent'        => $post_meta_box,
				'options'       => array(
					'default'     => esc_html__( 'Default', 'calla' ),
					'large-width' => esc_html__( 'Large Width', 'calla' )
				)
			)
		);
		
		calla_elated_create_meta_box_field(
			array(
				'name'          => 'eltdf_show_title_area_blog_meta',
				'type'          => 'select',
				'default_value' => '',
				'label'         => esc_html__( 'Show Title Area', 'calla' ),
				'description'   => esc_html__( 'Enabling this option will show title area on your single post page', 'calla' ),
				'parent'        => $post_meta_box,
				'options'       => calla_elated_get_yes_no_select_array()
			)
		);

		do_action('calla_elated_blog_post_meta', $post_meta_box);
	}
	
	add_action( 'calla_elated_meta_boxes_map', 'calla_elated_map_post_meta', 20 );
}
