<?php
/**
 * Topbar Section options
 *
 * @package Theme Palace
 * @subpackage Kompany
 * @since Kompany 1.0.0
 */

// Add Topbar section
$wp_customize->add_section( 'kompany_topbar_section', array(
	'title'             => esc_html__( 'Topbar','kompany' ),
	'description'       => esc_html__( 'Topbar Section options.', 'kompany' ),
	'panel'             => 'kompany_front_page_panel',
	'priority'			=> 1
) );

// topbar enable/disable control and setting
$wp_customize->add_setting( 'kompany_theme_options[topbar_section_enable]', array(
	'default'			=> 	$options['topbar_section_enable'],
	'sanitize_callback' => 'kompany_sanitize_switch_control',
) );

$wp_customize->add_control( new Kompany_Switch_Control( $wp_customize, 'kompany_theme_options[topbar_section_enable]', array(
	'label'             => esc_html__( 'Topbar Section Enable', 'kompany' ),
	'section'           => 'kompany_topbar_section',
	'on_off_label' 		=> kompany_switch_options(),
) ) );

$wp_customize->add_setting( 'kompany_theme_options[topbar_field_number]', array(
    'sanitize_callback' => 'sanitize_text_field',
    'transport'			=> 'postMessage',
) );

$wp_customize->add_control('kompany_theme_options[topbar_field_number]', array(
    'label'             => esc_html__( 'Contact Number', 'kompany' ),
    'section'           => 'kompany_topbar_section',
    'type'              => 'text',
    'active_callback'   => 'kompany_is_topbar_section_enable',
 ) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'kompany_theme_options[topbar_field_number]', array(
		'selector'            => '#top-navigation li.number',
		'settings'            => 'kompany_theme_options[topbar_field_number]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'kompany_topbar_field_number_partial',
    ) );
}

$wp_customize->add_setting( 'kompany_theme_options[topbar_field_email]', array(
    'sanitize_callback' => 'sanitize_text_field',
    'transport'			=> 'postMessage',
) );

$wp_customize->add_control('kompany_theme_options[topbar_field_email]', array(
    'label'             => esc_html__( 'Contact Email', 'kompany' ),
    'section'           => 'kompany_topbar_section',
    'type'              => 'text',
    'active_callback'   => 'kompany_is_topbar_section_enable',
 ) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'kompany_theme_options[topbar_field_email]', array(
		'selector'            => '#top-navigation li.email',
		'settings'            => 'kompany_theme_options[topbar_field_email]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'kompany_topbar_field_email_partial',
    ) );
}

// Topbar content enable control and setting
$wp_customize->add_setting( 'kompany_theme_options[social_menu_enable]', array(
	'default'			=> 	$options['social_menu_enable'],
	'sanitize_callback' => 'kompany_sanitize_switch_control',
) );

$wp_customize->add_control( new Kompany_Switch_Control( $wp_customize, 'kompany_theme_options[social_menu_enable]', array(
	'label'             => esc_html__( 'Social Menu Enable', 'kompany' ),
	'description'       => sprintf( '%1$s <a class="topbar-menu-trigger" href="#"> %2$s </a> %3$s', esc_html__( 'Note: To show social menu.', 'kompany' ), esc_html__( 'Click Here', 'kompany' ), esc_html__( 'to create menu', 'kompany' ) ),
	'section'           => 'kompany_topbar_section',
	'active_callback'   => 'kompany_is_topbar_section_enable',
	'on_off_label' 		=> kompany_switch_options(),
) ) );