<?php

if ( ! function_exists( 'calla_elated_map_content_bottom_meta' ) ) {
	function calla_elated_map_content_bottom_meta() {
		
		$content_bottom_meta_box = calla_elated_create_meta_box(
			array(
				'scope' => apply_filters( 'calla_elated_set_scope_for_meta_boxes', array( 'page', 'post' ), 'content_bottom_meta' ),
				'title' => esc_html__( 'Content Bottom', 'calla' ),
				'name'  => 'content_bottom_meta'
			)
		);
		
		calla_elated_create_meta_box_field(
			array(
				'name'          => 'eltdf_enable_content_bottom_area_meta',
				'type'          => 'select',
				'default_value' => '',
				'label'         => esc_html__( 'Enable Content Bottom Area', 'calla' ),
				'description'   => esc_html__( 'This option will enable Content Bottom area on pages', 'calla' ),
				'parent'        => $content_bottom_meta_box,
				'options'       => calla_elated_get_yes_no_select_array()
			)
		);
		
		$show_content_bottom_meta_container = calla_elated_add_admin_container(
			array(
				'parent'          => $content_bottom_meta_box,
				'name'            => 'eltdf_show_content_bottom_meta_container',
				'dependency' => array(
					'show' => array(
						'eltdf_enable_content_bottom_area_meta' => 'yes'
					)
				)
			)
		);
		
		calla_elated_create_meta_box_field(
			array(
				'name'          => 'eltdf_content_bottom_sidebar_custom_display_meta',
				'type'          => 'selectblank',
				'default_value' => '',
				'label'         => esc_html__( 'Sidebar to Display', 'calla' ),
				'description'   => esc_html__( 'Choose a content bottom sidebar to display', 'calla' ),
				'options'       => calla_elated_get_custom_sidebars(),
				'parent'        => $show_content_bottom_meta_container,
				'args'          => array(
					'select2' => true
				)
			)
		);
		
		calla_elated_create_meta_box_field(
			array(
				'type'          => 'select',
				'name'          => 'eltdf_content_bottom_in_grid_meta',
				'default_value' => '',
				'label'         => esc_html__( 'Display in Grid', 'calla' ),
				'description'   => esc_html__( 'Enabling this option will place content bottom in grid', 'calla' ),
				'options'       => calla_elated_get_yes_no_select_array(),
				'parent'        => $show_content_bottom_meta_container
			)
		);
		
		calla_elated_create_meta_box_field(
			array(
				'type'        => 'color',
				'name'        => 'eltdf_content_bottom_background_color_meta',
				'label'       => esc_html__( 'Background Color', 'calla' ),
				'description' => esc_html__( 'Choose a background color for content bottom area', 'calla' ),
				'parent'      => $show_content_bottom_meta_container
			)
		);
	}
	
	add_action( 'calla_elated_meta_boxes_map', 'calla_elated_map_content_bottom_meta', 71 );
}