<?php
/**
 * Header Main Row Options
 *
 * @package Code4rest
 */

namespace Code4rest;

use Code4rest\Theme_Customizer;
use function Code4rest\code4rest;

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(
	'mobile_html_tabs' => array(
		'control_type' => 'code4rest_blank_control',
		'section'      => 'mobile_html',
		'settings'     => false,
		'priority'     => 1,
		'description'  => $compontent_tabs,
	),
	'mobile_html_content' => array(
		'control_type' => 'code4rest_editor_control',
		'section'      => 'mobile_html',
		'sanitize'     => 'wp_kses_post',
		'priority'     => 4,
		'default'      => code4rest()->default( 'mobile_html_content' ),
		'context'      => array(
			array(
				'setting' => '__current_tab',
				'value'   => 'general',
			),
		),
		'input_attrs'  => array(
			'id' => 'mobile_html',
		),
		'partial'      => array(
			'selector'            => '.mobile-html',
			'container_inclusive' => true,
			'render_callback'     => 'Code4rest\mobile_html',
		),
	),
	'mobile_html_wpautop' => array(
		'control_type' => 'code4rest_switch_control',
		'sanitize'     => 'code4rest_sanitize_toggle',
		'section'      => 'mobile_html',
		'default'      => code4rest()->default( 'mobile_html_wpautop' ),
		'label'        => esc_html__( 'Automatically Add Paragraphs', 'code4rest' ),
		'context'      => array(
			array(
				'setting' => '__current_tab',
				'value'   => 'general',
			),
		),
		'partial'      => array(
			'selector'            => '.mobile-html',
			'container_inclusive' => true,
			'render_callback'     => 'Code4rest\mobile_html',
		),
	),
	'mobile_html_typography' => array(
		'control_type' => 'code4rest_typography_control',
		'section'      => 'mobile_html',
		'label'        => esc_html__( 'Font', 'code4rest' ),
		'context'      => array(
			array(
				'setting' => '__current_tab',
				'value'   => 'design',
			),
		),
		'default'      => code4rest()->default( 'mobile_html_typography' ),
		'live_method'     => array(
			array(
				'type'     => 'css_typography',
				'selector' => '.mobile-html',
				'pattern'  => array(
					'desktop' => '$',
					'tablet'  => '$',
					'mobile'  => '$',
				),
				'property' => 'font',
				'key'      => 'typography',
			),
		),
		'input_attrs'  => array(
			'id' => 'mobile_html_typography',
		),
	),
	'mobile_html_link_color' => array(
		'control_type' => 'code4rest_color_control',
		'section'      => 'mobile_html',
		'label'        => esc_html__( 'Link Colors', 'code4rest' ),
		'default'      => code4rest()->default( 'mobile_html_link_color' ),
		'live_method'     => array(
			array(
				'type'     => 'css',
				'selector' => '.mobile-html a',
				'property' => 'color',
				'pattern'  => '$',
				'key'      => 'color',
			),
			array(
				'type'     => 'css',
				'selector' => '.mobile-html a:hover',
				'property' => 'color',
				'pattern'  => '$',
				'key'      => 'hover',
			),
		),
		'context'      => array(
			array(
				'setting' => '__current_tab',
				'value'   => 'design',
			),
		),
		'input_attrs'  => array(
			'colors' => array(
				'color' => array(
					'tooltip' => __( 'Initial Color', 'code4rest' ),
					'palette' => true,
				),
				'hover' => array(
					'tooltip' => __( 'Hover Color', 'code4rest' ),
					'palette' => true,
				),
			),
		),
	),
	'mobile_html_link_style' => array(
		'control_type' => 'code4rest_select_control',
		'section'      => 'mobile_html',
		'default'      => code4rest()->default( 'mobile_html_link_style' ),
		'label'        => esc_html__( 'Link Style', 'code4rest' ),
		'context'      => array(
			array(
				'setting' => '__current_tab',
				'value'   => 'design',
			),
		),
		'input_attrs'  => array(
			'options' => array(
				'normal' => array(
					'name' => __( 'Underline', 'code4rest' ),
				),
				'plain' => array(
					'name' => __( 'No Underline', 'code4rest' ),
				),
			),
		),
		'live_method'     => array(
			array(
				'type'     => 'class',
				'selector' => '#mobile-header .mobile-html',
				'pattern'  => 'inner-link-style-$',
				'key'      => '',
			),
		),
	),
	'mobile_html_margin' => array(
		'control_type' => 'code4rest_measure_control',
		'section'      => 'mobile_html',
		'priority'     => 10,
		'default'      => code4rest()->default( 'mobile_html_margin' ),
		'label'        => esc_html__( 'Margin', 'code4rest' ),
		'context'      => array(
			array(
				'setting' => '__current_tab',
				'value'   => 'design',
			),
		),
		'live_method'     => array(
			array(
				'type'     => 'css',
				'selector' => '.mobile-html',
				'property' => 'margin',
				'pattern'  => '$',
				'key'      => 'measure',
			),
		),
		'input_attrs'  => array(
			'responsive' => false,
		),
	),
);

Theme_Customizer::add_settings( $settings );

