<?php
/**
 * Customizer fields for single post layout settings.
 *
 * @package Eronex
 * @since   0.0.1
 */

use Kirki\Field\Dimensions;
use Kirki\Field\Image;
use Kirki\Field\Select;
use Kirki\Pro\Field\Divider;
use Kirki\Pro\Field\HeadlineToggle;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

new HeadlineToggle(
	array(
		'label'    => esc_html__( 'Banner', 'eronex' ),
		'settings' => 'eronex_single_banner_enable',
		'section'  => 'eronex_layout_single',
		'default'  => true,
		array(
			'setting'  => 'eronex_banner_enable',
			'operator' => '===',
			'value'    => true,
		),
	)
);

new Image(
	array(
		'label'           => esc_html__( 'Background Image', 'eronex' ),
		'settings'        => 'eronex_single_banner_bg',
		'section'         => 'eronex_layout_single',
		'transport'       => 'auto',
		'output'          => array(
			array(
				'element' => 'body.single .eronex-banner',
				'property' => 'background-image',
			),
		),
		'active_callback' => array(
			array(
				'setting'  => 'eronex_banner_enable',
				'operator' => '===',
				'value'    => true,
			),
			array(
				'setting'  => 'eronex_single_banner_enable',
				'operator' => '===',
				'value'    => true,
			),
		),
	)
);

new Divider(
	array(
		'settings' => 'eronex_single_container_layout_separator',
		'section'  => 'eronex_layout_single',
		'choices'  => array(
			'color' => $separator_color,
		),
	),
);

new Select(
	array(
		'label'    => esc_html__( 'Container Layout', 'eronex' ),
		'settings' => 'eronex_single_container_layout',
		'section'  => 'eronex_layout_single',
		'default'  => '',
		'choices'  => array(
			''                => esc_html__( 'Default', 'eronex' ),
			'container'       => esc_html__( 'Normal', 'eronex' ),
			'container-fluid' => esc_html__( 'Fluid', 'eronex' ),
			'full-width'      => esc_html__( 'Full Width', 'eronex' ),
		),
	)
);

new Divider(
	array(
		'settings' => 'eronex_single_sidebar_layout_separator',
		'section'  => 'eronex_layout_single',
		'choices'  => array(
			'color' => $separator_color,
		),
	),
);

new Select(
	array(
		'label'    => esc_html__( 'Sidebar Layout', 'eronex' ),
		'settings' => 'eronex_single_sidebar_layout',
		'section'  => 'eronex_layout_single',
		'default'  => '',
		'choices'  => array(
			''      => esc_html__( 'Default', 'eronex' ),
			'none'  => esc_html__( 'No Sidebar', 'eronex' ),
			'left'  => esc_html__( 'Left Sidebar', 'eronex' ),
			'right' => esc_html__( 'Right Sidebar', 'eronex' ),
		),
	)
);

new Divider(
	array(
		'settings' => 'eronex_single_content_padding_separator',
		'section'  => 'eronex_layout_single',
		'choices'  => array(
			'color' => $separator_color,
		),
	),
);

new Dimensions(
	array(
		'settings'   => 'eronex_single_content_padding',
		'label'      => esc_html__( 'Content Padding', 'eronex' ),
		'section'    => 'eronex_layout_single',
		'default'    => array(
			'mobile'  => array(
				'padding-top'    => '',
				'padding-bottom' => '',
			),
			'tablet'  => array(
				'padding-top'    => '',
				'padding-bottom' => '',
			),
			'desktop' => array(
				'padding-top'    => '',
				'padding-bottom' => '',
			),
		),
		'choices'    => array(
			'labels' => array(
				'padding-top'    => esc_html__( 'Top', 'eronex' ),
				'padding-bottom' => esc_html__( 'Bottom', 'eronex' ),
			),
		),
		'output'     => array(
			array(
				'element'     => 'body.single .eronex-content-inner',
				'media_query' => array(
					'desktop' => $desktop_media_query,
					'tablet'  => $tablet_media_query,
					'mobile'  => $mobile_media_query,
				),
			),
		),
		'transport'  => 'auto',
		'responsive' => true,
	)
);