<?php
/**
 * Header Builder Options
 *
 * @package Code4rest
 */

namespace Code4rest;

use Code4rest\Theme_Customizer;
use function Code4rest\code4rest;

ob_start(); ?>
<!-- <div class="code4rest-build-tabs nav-tab-wrapper wp-clearfix">
	<a href="#" class="nav-tab preview-desktop code4rest-build-tabs-button" data-device="desktop">
		<span class="dashicons dashicons-desktop"></span>
		<span><?php esc_html_e( 'Desktop', 'code4rest' ); ?></span>
	</a>
	<a href="#" class="nav-tab preview-tablet preview-mobile code4rest-build-tabs-button" data-device="tablet">
		<span class="dashicons dashicons-smartphone"></span>
		<span><?php esc_html_e( 'Tablet / Mobile', 'code4rest' ); ?></span>
	</a>
</div> -->
<span class="button button-secondary code4rest-builder-hide-button code4rest-builder-tab-toggle"><span class="dashicons dashicons-no"></span><?php esc_html_e( 'Hide', 'code4rest' ); ?></span>
<span class="button button-secondary code4rest-builder-show-button code4rest-builder-tab-toggle"><span class="dashicons dashicons-edit"></span><?php esc_html_e( 'Footer Builder', 'code4rest' ); ?></span>
<?php
$builder_tabs = ob_get_clean();
ob_start(); ?>
<div class="code4rest-compontent-tabs nav-tab-wrapper wp-clearfix">
	<a href="#" class="nav-tab code4rest-general-tab code4rest-compontent-tabs-button nav-tab-active" data-tab="general">
		<span><?php esc_html_e( 'General', 'code4rest' ); ?></span>
	</a>
	<a href="#" class="nav-tab code4rest-design-tab code4rest-compontent-tabs-button" data-tab="design">
		<span><?php esc_html_e( 'Design', 'code4rest' ); ?></span>
	</a>
</div>
<?php
$compontent_tabs = ob_get_clean();
$settings = array(
	'footer_builder' => array(
		'control_type' => 'code4rest_blank_control',
		'section'      => 'footer_builder',
		'settings'     => false,
		'description'  => $builder_tabs,
	),
	'footer_items' => array(
		'control_type' => 'code4rest_builder_control',
		'section'      => 'footer_builder',
		'default'      => code4rest()->default( 'footer_items' ),
		'partial'      => array(
			'selector'            => '#colophon',
			'container_inclusive' => true,
			'render_callback'     => 'Code4rest\footer_markup',
		),
		'choices'      => array(
			'footer-navigation'          => array(
				'name'    => esc_html__( 'Footer Navigation', 'code4rest' ),
				'section' => 'code4rest_customizer_footer_navigation',
			),
			'footer-social'        => array(
				'name'    => esc_html__( 'Social', 'code4rest' ),
				'section' => 'code4rest_customizer_footer_social',
			),
			'footer-html'          => array(
				'name'    => esc_html__( 'Copyright', 'code4rest' ),
				'section' => 'code4rest_customizer_footer_html',
			),
			'footer-widget1' => array(
				'name'    => esc_html__( 'Widget 1', 'code4rest' ),
				'section' => 'sidebar-widgets-footer1',
			),
			'footer-widget2' => array(
				'name'    => esc_html__( 'Widget 2', 'code4rest' ),
				'section' => 'sidebar-widgets-footer2',
			),
			'footer-widget3' => array(
				'name'    => esc_html__( 'Widget 3', 'code4rest' ),
				'section' => 'sidebar-widgets-footer3',
			),
			'footer-widget4' => array(
				'name'    => esc_html__( 'Widget 4', 'code4rest' ),
				'section' => 'sidebar-widgets-footer4',
			),
			'footer-widget5' => array(
				'name'    => esc_html__( 'Widget 5', 'code4rest' ),
				'section' => 'sidebar-widgets-footer5',
			),
			'footer-widget6' => array(
				'name'    => esc_html__( 'Widget 6', 'code4rest' ),
				'section' => 'sidebar-widgets-footer6',
			),
		),
		'input_attrs'  => array(
			'group' => 'footer_items',
			'rows'  => array( 'top', 'middle', 'bottom' ),
			'zones' => array(
				'top' => array(
					'top_1' => esc_html__( 'Top - 1', 'code4rest' ),
					'top_2' => esc_html__( 'Top - 2', 'code4rest' ),
					'top_3' => esc_html__( 'Top - 3', 'code4rest' ),
					'top_4' => esc_html__( 'Top - 4', 'code4rest' ),
					'top_5' => esc_html__( 'Top - 5', 'code4rest' ),
				),
				'middle' => array(
					'middle_1' => esc_html__( 'Middle - 1', 'code4rest' ),
					'middle_2' => esc_html__( 'Middle - 2', 'code4rest' ),
					'middle_3' => esc_html__( 'Middle - 3', 'code4rest' ),
					'middle_4' => esc_html__( 'Middle - 4', 'code4rest' ),
					'middle_5' => esc_html__( 'Middle - 5', 'code4rest' ),
				),
				'bottom' => array(
					'bottom_1' => esc_html__( 'Bottom - 1', 'code4rest' ),
					'bottom_2' => esc_html__( 'Bottom - 2', 'code4rest' ),
					'bottom_3' => esc_html__( 'Bottom - 3', 'code4rest' ),
					'bottom_4' => esc_html__( 'Bottom - 4', 'code4rest' ),
					'bottom_5' => esc_html__( 'Bottom - 5', 'code4rest' ),
				),
			),
		),
	),
	'footer_tab_settings' => array(
		'control_type' => 'code4rest_blank_control',
		'section'      => 'footer_layout',
		'settings'     => false,
		'priority'     => 1,
		'description'  => $compontent_tabs,
	),
	'footer_available_items' => array(
		'control_type' => 'code4rest_available_control',
		'section'      => 'footer_layout',
		'settings'     => false,
		'input_attrs'  => array(
			'group'  => 'footer_items',
			'zones'  => array( 'top', 'middle', 'bottom' ),
		),
		'context'      => array(
			array(
				'setting' => '__current_tab',
				'value'   => 'general',
			),
		),
	),
	'footer_wrap_background' => array(
		'control_type' => 'code4rest_background_control',
		'section'      => 'footer_layout',
		'label'        => esc_html__( 'Footer Background', 'code4rest' ),
		'default'      => code4rest()->default( 'footer_wrap_background' ),
		'live_method'     => array(
			array(
				'type'     => 'css_background',
				'selector' => '#colophon',
				'property' => 'background',
				'pattern'  => '$',
				'key'      => 'base',
			),
		),
		'context'      => array(
			array(
				'setting' => '__current_tab',
				'value'   => 'design',
			),
		),
		'input_attrs'  => array(
			'tooltip'  => __( 'Footer Background', 'code4rest' ),
		),
	),
	'enable_footer_on_bottom' => array(
		'control_type' => 'code4rest_switch_control',
		'sanitize'     => 'code4rest_sanitize_toggle',
		'section'      => 'footer_layout',
		'default'      => code4rest()->default( 'enable_footer_on_bottom' ),
		'label'        => esc_html__( 'Keep footer on bottom of screen', 'code4rest' ),
		'transport'    => 'refresh',
		'context'      => array(
			array(
				'setting' => '__current_tab',
				'value'   => 'design',
			),
		),
	),
);

Theme_Customizer::add_settings( $settings );

