<?php
/**
 * 404 Layout options.
 *
 * @package Code4rest
 */

namespace Code4rest;

use Code4rest\Theme_Customizer;
use function Code4rest\code4rest;

$layout_404_settings = array(
	'404_tabs' => array(
		'control_type' => 'code4rest_tab_control',
		'section'      => 'general_404',
		'settings'     => false,
		'priority'     => 1,
		'input_attrs'  => array(
			'general' => array(
				'label'  => __( 'General', 'code4rest' ),
				'target' => 'general_404',
			),
			'design' => array(
				'label'  => __( 'Design', 'code4rest' ),
				'target' => 'general_404_design',
			),
			'active' => 'general',
		),
	),
	'404_tabs_design' => array(
		'control_type' => 'code4rest_tab_control',
		'section'      => 'general_404_design',
		'settings'     => false,
		'priority'     => 1,
		'input_attrs'  => array(
			'general' => array(
				'label'  => __( 'General', 'code4rest' ),
				'target' => 'general_404',
			),
			'design' => array(
				'label'  => __( 'Design', 'code4rest' ),
				'target' => 'general_404_design',
			),
			'active' => 'design',
		),
	),
	'info_404_layout' => array(
		'control_type' => 'code4rest_title_control',
		'section'      => 'general_404',
		'priority'     => 10,
		'label'        => esc_html__( '404 Layout', 'code4rest' ),
		'settings'     => false,
	),
	'info_404_layout_design' => array(
		'control_type' => 'code4rest_title_control',
		'section'      => 'general_404_design',
		'priority'     => 10,
		'label'        => esc_html__( '404 Layout', 'code4rest' ),
		'settings'     => false,
	),
	'404_layout' => array(
		'control_type' => 'code4rest_radio_icon_control',
		'section'      => 'general_404',
		'label'        => esc_html__( '404 Layout', 'code4rest' ),
		'transport'    => 'refresh',
		'priority'     => 10,
		'default'      => code4rest()->default( '404_layout' ),
		'input_attrs'  => array(
			'layout' => array(
				'normal' => array(
					'name' => __( 'Normal', 'code4rest' ),
					'icon' => 'normal',
				),
				'narrow' => array(
					'name' => __( 'Narrow', 'code4rest' ),
					'icon' => 'narrow',
				),
				'fullwidth' => array(
					'name' => __( 'Fullwidth', 'code4rest' ),
					'icon' => 'fullwidth',
				),
				'left' => array(
					'name' => __( 'Left Sidebar', 'code4rest' ),
					'icon' => 'leftsidebar',
				),
				'right' => array(
					'name' => __( 'Right Sidebar', 'code4rest' ),
					'icon' => 'rightsidebar',
				),
			),
			'class'      => 'code4rest-three-col',
			'responsive' => false,
		),
	),
	'404_sidebar_id' => array(
		'control_type' => 'code4rest_select_control',
		'section'      => 'general_404',
		'label'        => esc_html__( '404 Default Sidebar', 'code4rest' ),
		'transport'    => 'refresh',
		'priority'     => 10,
		'default'      => code4rest()->default( '404_sidebar_id' ),
		'input_attrs'  => array(
			'options' => code4rest()->sidebar_options(),
		),
	),
	'404_content_style' => array(
		'control_type' => 'code4rest_radio_icon_control',
		'section'      => 'general_404',
		'label'        => esc_html__( 'Content Style', 'code4rest' ),
		'priority'     => 10,
		'default'      => code4rest()->default( '404_content_style' ),
		'live_method'     => array(
			array(
				'type'     => 'class',
				'selector' => 'body.error404',
				'pattern'  => 'content-style-$',
				'key'      => '',
			),
		),
		'input_attrs'  => array(
			'layout' => array(
				'boxed' => array(
					'name' => __( 'Boxed', 'code4rest' ),
					'icon' => 'boxed',
				),
				'unboxed' => array(
					'name' => __( 'Unboxed', 'code4rest' ),
					'icon' => 'narrow',
				),
			),
			'responsive' => false,
			'class'      => 'code4rest-two-col',
		),
	),
	'404_vertical_padding' => array(
		'control_type' => 'code4rest_radio_icon_control',
		'section'      => 'general_404',
		'label'        => esc_html__( 'Content Vertical Padding', 'code4rest' ),
		'priority'     => 10,
		'default'      => code4rest()->default( '404_vertical_padding' ),
		'context'      => array(
			array(
				'setting' => '__current_tab',
				'value'   => 'general',
			),
		),
		'live_method'     => array(
			array(
				'type'     => 'class',
				'selector' => 'body.error404',
				'pattern'  => 'content-vertical-padding-$',
				'key'      => '',
			),
		),
		'input_attrs'  => array(
			'layout' => array(
				'show' => array(
					'name' => __( 'Enable', 'code4rest' ),
				),
				'hide' => array(
					'name' => __( 'Disable', 'code4rest' ),
				),
				'top' => array(
					'name' => __( 'Top Only', 'code4rest' ),
				),
				'bottom' => array(
					'name' => __( 'Bottom Only', 'code4rest' ),
				),
			),
			'responsive' => false,
			'class'      => 'code4rest-two-grid',
		),
	),
	'404_background' => array(
		'control_type' => 'code4rest_background_control',
		'section'      => 'general_404_design',
		'label'        => esc_html__( 'Site Background', 'code4rest' ),
		'default'      => code4rest()->default( '404_background' ),
		'live_method'     => array(
			array(
				'type'     => 'css_background',
				'selector' => 'body.error404',
				'property' => 'background',
				'pattern'  => '$',
				'key'      => 'base',
			),
		),
		'input_attrs'  => array(
			'tooltip' => __( '404 Background', 'code4rest' ),
		),
	),
	'404_content_background' => array(
		'control_type' => 'code4rest_background_control',
		'section'      => 'general_404_design',
		'label'        => esc_html__( 'Content Background', 'code4rest' ),
		'default'      => code4rest()->default( '404_content_background' ),
		'live_method'  => array(
			array(
				'type'     => 'css_background',
				'selector' => 'body.error404 .content-bg, body.error404.content-style-unboxed .site',
				'property' => 'background',
				'pattern'  => '$',
				'key'      => 'base',
			),
		),
		'input_attrs'  => array(
			'tooltip' => __( '404 Content Background', 'code4rest' ),
		),
	),
);
Theme_Customizer::add_settings( $layout_404_settings );
