<?php
// Top bar
$wp_customize->add_setting(
	'topbar_enabled',
	array(
		'sanitize_callback' => 'themesflat_sanitize_checkbox',
		'default'           => themesflat_customize_default( 'topbar_enabled' ),
	)
);

$wp_customize->add_control( new themesflat_Checkbox( $wp_customize,
		'topbar_enabled',
		array(
			'type'     => 'checkbox',
			'label'    => esc_html__( 'Enable Topbar ( OFF | ON )', 'devoer' ),
			'section'  => 'section_topbar',
			'priority' => 1,
			'settings' => 'topbar_enabled',
		) )
);

$wp_customize->add_setting( 'themesflat_options[info]', array(
		'type'              => 'info_control',
		'capability'        => 'edit_theme_options',
		'sanitize_callback' => 'esc_attr',
	)
);

$wp_customize->add_control( new themesflat_Info( $wp_customize, 'label_topbar_left', array(
		'label'    => esc_html__( 'Topbar Left', 'devoer' ),
		'section'  => 'section_topbar',
		'settings' => 'themesflat_options[info]',
		'priority' => 5
	) )
);

$wp_customize->add_setting(
	'social_topbar_left',
	array(
		'sanitize_callback' => 'themesflat_sanitize_checkbox',
		'default'           => themesflat_customize_default( 'social_topbar_left' ),
	)
);
$wp_customize->add_control( new themesflat_Checkbox( $wp_customize,
		'social_topbar_left',
		array(
			'type'     => 'checkbox',
			'label'    => esc_html__( 'Social Left( OFF | ON )', 'devoer' ),
			'section'  => 'section_topbar',
			'priority' => 10,
			'settings' => 'social_topbar_left',
		) )
);

$wp_customize->add_setting(
	'topbar_left_custom_html_enable',
	array(
		'sanitize_callback' => 'themesflat_sanitize_checkbox',
		'default'           => themesflat_customize_default( 'topbar_left_custom_html_enable' ),
	)
);
$wp_customize->add_control( new themesflat_Checkbox( $wp_customize,
		'topbar_left_custom_html_enable',
		array(
			'type'     => 'checkbox',
			'label'    => esc_html__( ' Custom html ( OFF | ON )', 'devoer' ),
			'section'  => 'section_topbar',
			'priority' => 20,
		) )
);

$wp_customize->add_setting(
	'topbar_left_custom_html',
	array(
		'default'           => themesflat_customize_default( 'topbar_left_custom_html' ),
		'sanitize_callback' => 'themesflat_sanitize_text'
	)
);
$wp_customize->add_control(
	'topbar_left_custom_html',
	array(
		'label'           => esc_html__( 'Custom HTML', 'devoer' ),
		'section'         => 'section_topbar',
		'type'            => 'textarea',
		'priority'        => 30,
		'active_callback' => function () use ( $wp_customize ) {
			return 1 === $wp_customize->get_setting( 'topbar_left_custom_html_enable' )->value();
		},

	)
);

$wp_customize->add_control( new themesflat_Info( $wp_customize, 'label_topbar_right', array(
		'label'    => esc_html__( 'Topbar Right', 'devoer' ),
		'section'  => 'section_topbar',
		'settings' => 'themesflat_options[info]',
		'priority' => 40
	) )
);


$wp_customize->add_setting(
	'social_topbar_right',
	array(
		'sanitize_callback' => 'themesflat_sanitize_checkbox',
		'default'           => themesflat_customize_default( 'social_topbar_right' ),
	)
);
$wp_customize->add_control( new themesflat_Checkbox( $wp_customize,
		'social_topbar_right',
		array(
			'type'     => 'checkbox',
			'label'    => esc_html__( 'Social Right( OFF | ON )', 'devoer' ),
			'section'  => 'section_topbar',
			'priority' => 50,
			'settings' => 'social_topbar_right',
		) )
);
$wp_customize->add_setting(
	'topbar_right_custom_html_enable',
	array(
		'sanitize_callback' => 'themesflat_sanitize_checkbox',
		'default'           => themesflat_customize_default( 'topbar_right_custom_html_enable' ),
	)
);
$wp_customize->add_control( new themesflat_Checkbox( $wp_customize,
		'topbar_right_custom_html_enable',
		array(
			'type'     => 'checkbox',
			'label'    => esc_html__( ' Custom html ( OFF | ON )', 'devoer' ),
			'section'  => 'section_topbar',
			'priority' => 60,
		) )
);

$wp_customize->add_setting(
	'topbar_right_custom_html',
	array(
		'default'           => themesflat_customize_default( 'topbar_right_custom_html' ),
		'sanitize_callback' => 'themesflat_sanitize_text'
	)
);
$wp_customize->add_control(
	'topbar_right_custom_html',
	array(
		'label'           => esc_html__( 'Custom HTML', 'devoer' ),
		'section'         => 'section_topbar',
		'type'            => 'textarea',
		'priority'        => 70,
		'active_callback' => function () use ( $wp_customize ) {
			return 1 === $wp_customize->get_setting( 'topbar_right_custom_html_enable' )->value();
		},

	)
);

// Topbar Box control
$wp_customize->add_setting(
	'topbar_controls',
	array(
		'default'           => themesflat_customize_default( 'topbar_controls' ),
		'sanitize_callback' => 'themesflat_sanitize_text',
	)
);
$wp_customize->add_control( new themesflat_BoxControls( $wp_customize,
		'topbar_controls',
		array(
			'label'    => esc_html__( 'Box Controls (px)', 'devoer' ),
			'section'  => 'section_topbar',
			'type'     => 'box-controls',
			'priority' => 100,

		) )
);