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

// Add Header Content section
$wp_customize->add_section( 'kompany_header_content_section', array(
	'title'             => esc_html__( 'Header Content','kompany' ),
	'description'       => esc_html__( 'Header Content Section options.', 'kompany' ),
	'panel'             => 'kompany_front_page_panel',
) );

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

$wp_customize->add_control( new Kompany_Switch_Control( $wp_customize, 'kompany_theme_options[header_content_section_enable]', array(
	'label'             => esc_html__( 'Header Content Section Enable', 'kompany' ),
	'section'           => 'kompany_header_content_section',
	'on_off_label' 		=> kompany_switch_options(),
) ) );

// Courses btn label setting and control
$wp_customize->add_setting( 'kompany_theme_options[header_content_sub_title]', array(
	'sanitize_callback' => 'wp_kses_post',
	'default'			=> $options['header_content_sub_title'],
	'transport'			=> 'postMessage',
) );

$wp_customize->add_control( 'kompany_theme_options[header_content_sub_title]', array(
	'label'           	=> esc_html__( 'Section Sub Title', 'kompany' ),
	'section'        	=> 'kompany_header_content_section',
	'active_callback' 	=> 'kompany_is_header_content_section_enable',
	'type'				=> 'text',
) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'kompany_theme_options[header_content_sub_title]', array(
		'selector'            => '#kompany_header_content_section p.section-subtitle',
		'settings'            => 'kompany_theme_options[header_content_sub_title]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'kompany_header_content_sub_title_partial',
    ) );
}

// Courses btn label setting and control
$wp_customize->add_setting( 'kompany_theme_options[header_content_title]', array(
	'sanitize_callback' => 'sanitize_text_field',
	'default'			=> $options['header_content_title'],
	'transport'			=> 'postMessage',
) );

$wp_customize->add_control( 'kompany_theme_options[header_content_title]', array(
	'label'           	=> esc_html__( 'Section Title', 'kompany' ),
	'section'        	=> 'kompany_header_content_section',
	'active_callback' 	=> 'kompany_is_header_content_section_enable',
	'type'				=> 'text',
) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'kompany_theme_options[header_content_title]', array(
		'selector'            => '#kompany_header_content_section h2.section-title',
		'settings'            => 'kompany_theme_options[header_content_title]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'kompany_header_content_title_partial',
    ) );
}