<?php
/**
 * Banner Section
 *
 * @package online_school_courses
 */

$wp_customize->add_section(
	'online_school_courses_banner_section',
	array(
		'panel'    => 'online_school_courses_front_page_options',
		'title'    => esc_html__( 'Banner Section', 'online-school-courses' ),
		'priority' => 10,
	)
);

// Banner Section - Enable Section.
$wp_customize->add_setting(
	'online_school_courses_enable_banner_section',
	array(
		'default'           => false,
		'sanitize_callback' => 'online_school_courses_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Online_School_Courses_Toggle_Switch_Custom_Control(
		$wp_customize,
		'online_school_courses_enable_banner_section',
		array(
			'label'    => esc_html__( 'Enable Banner Section', 'online-school-courses' ),
			'section'  => 'online_school_courses_banner_section',
			'settings' => 'online_school_courses_enable_banner_section',
		)
	)
);

if ( isset( $wp_customize->selective_refresh ) ) {
	$wp_customize->selective_refresh->add_partial(
		'online_school_courses_enable_banner_section',
		array(
			'selector' => '#online_school_courses_banner_section .section-link',
			'settings' => 'online_school_courses_enable_banner_section',
		)
	);
}

// Banner Section - Banner Heading.
$wp_customize->add_setting(
	'online_school_courses_banner_section_heading',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'online_school_courses_banner_section_heading',
	array(
		'label'           => sprintf( esc_html__( 'Banner Heading', 'online-school-courses' )),
		'section'         => 'online_school_courses_banner_section',
		'settings'        => 'online_school_courses_banner_section_heading',
		'type'            => 'text',
		'active_callback' => 'online_school_courses_is_banner_slider_section_enabled',
	)
);

// Banner Section - Banner Content.
$wp_customize->add_setting(
	'online_school_courses_banner_section_content',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'online_school_courses_banner_section_content',
	array(
		'label'           => sprintf( esc_html__( 'Banner Content', 'online-school-courses' )),
		'section'         => 'online_school_courses_banner_section',
		'settings'        => 'online_school_courses_banner_section_content',
		'type'            => 'text',
		'active_callback' => 'online_school_courses_is_banner_slider_section_enabled',
	)
);

// Banner Section - Button Label.
$wp_customize->add_setting(
	'online_school_courses_banner_button_label_',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'online_school_courses_banner_button_label_',
	array(
		'label'           => sprintf( esc_html__( 'Button Label 1', 'online-school-courses' )),
		'section'         => 'online_school_courses_banner_section',
		'settings'        => 'online_school_courses_banner_button_label_',
		'type'            => 'text',
		'active_callback' => 'online_school_courses_is_banner_slider_section_enabled',
	)
);

// Banner Section - Button Link.
$wp_customize->add_setting(
	'online_school_courses_banner_button_link_' ,
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'online_school_courses_banner_button_link_' ,
	array(
		'label'           => sprintf( esc_html__( 'Button Link 1', 'online-school-courses' )  ),
		'section'         => 'online_school_courses_banner_section',
		'settings'        => 'online_school_courses_banner_button_link_' ,
		'type'            => 'url',
		'active_callback' => 'online_school_courses_is_banner_slider_section_enabled',
	)
);

// Banner Section - Button Label.
$wp_customize->add_setting(
	'online_school_courses_banner_button_label_2',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'online_school_courses_banner_button_label_2',
	array(
		'label'           => sprintf( esc_html__( 'Button Label 2', 'online-school-courses' )),
		'section'         => 'online_school_courses_banner_section',
		'settings'        => 'online_school_courses_banner_button_label_2',
		'type'            => 'text',
		'active_callback' => 'online_school_courses_is_banner_slider_section_enabled',
	)
);

// Banner Section - Button Link.
$wp_customize->add_setting(
	'online_school_courses_banner_button_link_2' ,
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'online_school_courses_banner_button_link_2' ,
	array(
		'label'           => sprintf( esc_html__( 'Button Link 2', 'online-school-courses' )  ),
		'section'         => 'online_school_courses_banner_section',
		'settings'        => 'online_school_courses_banner_button_link_2' ,
		'type'            => 'url',
		'active_callback' => 'online_school_courses_is_banner_slider_section_enabled',
	)
);

// Footer Background Image Setting
$wp_customize->add_setting('online_school_courses_banner_section_image', array(
    'default' => '',
    'sanitize_callback' => 'esc_url_raw',
));

$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'online_school_courses_banner_section_image', array(
    'label' => __('Banner Image', 'online-school-courses'),
    'section' => 'online_school_courses_banner_section',
	'active_callback' => 'online_school_courses_is_banner_slider_section_enabled',
)));

// Enable Social Icons.
$wp_customize->add_setting(
	'online_school_courses_enable_banner_icon_section',
	array(
		'default'           => false,
		'sanitize_callback' => 'online_school_courses_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Online_School_Courses_Toggle_Switch_Custom_Control(
		$wp_customize,
		'online_school_courses_enable_banner_icon_section',
		array(
			'label'    => esc_html__( 'Enable Social', 'online-school-courses' ),
			'section'  => 'online_school_courses_banner_section',
			'settings' => 'online_school_courses_enable_banner_icon_section',
		)
	)
);

// Add setting for Facebook Link
$wp_customize->add_setting(
	'online_school_courses_banner_facebook_link',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'online_school_courses_banner_facebook_link',
	array(
		'label'           => esc_html__( 'Facebook Link', 'online-school-courses'  ),
		'section'         => 'online_school_courses_banner_section',
		'settings'        => 'online_school_courses_banner_facebook_link',
		'type'      => 'url'
	)
);

// Add setting for Twitter Link
$wp_customize->add_setting(
	'online_school_courses_banner_twitter_link',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'online_school_courses_banner_twitter_link',
	array(
		'label'           => esc_html__( 'Twitter Link', 'online-school-courses'  ),
		'section'         => 'online_school_courses_banner_section',
		'settings'        => 'online_school_courses_banner_twitter_link',
		'type'      => 'url'
	)
);

// Add setting for Linkedin Link
$wp_customize->add_setting(
	'online_school_courses_banner_linkedin_link',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'online_school_courses_banner_linkedin_link',
	array(
		'label'           => esc_html__( 'Linkedin Link', 'online-school-courses'  ),
		'section'         => 'online_school_courses_banner_section',
		'settings'        => 'online_school_courses_banner_linkedin_link',
		'type'      => 'url'
	)
);

// Add setting for Instagram Link
$wp_customize->add_setting(
	'online_school_courses_banner_instagram_link',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'online_school_courses_banner_instagram_link',
	array(
		'label'           => esc_html__( 'Instagram Link', 'online-school-courses'  ),
		'section'         => 'online_school_courses_banner_section',
		'settings'        => 'online_school_courses_banner_instagram_link',
		'type'      => 'url'
	)
);

// Banner Button Label Color
$wp_customize->add_setting(
	'online_school_courses_banner_btn_color',
	array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'online_school_courses_banner_btn_color',array(
			'label' => __('Banner Button Label Color','online-school-courses'),
			'section' => 'online_school_courses_banner_section',
			'settings' => 'online_school_courses_banner_btn_color',
			'active_callback' => 'online_school_courses_is_banner_slider_section_enabled',
		)
	)
);

// Banner Button Background Color
$wp_customize->add_setting('online_school_courses_banner_btn_bg_color',array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'online_school_courses_banner_btn_bg_color',array(
			'label' => __('Banner Button Background Color','online-school-courses'),
			'section' => 'online_school_courses_banner_section',
			'settings' => 'online_school_courses_banner_btn_bg_color',
			'active_callback' => 'online_school_courses_is_banner_slider_section_enabled',
		)
	)
);

$wp_customize->add_setting( 
	'online_school_courses_banner_settings_upgraded_features',
	array(
		'sanitize_callback' => 'sanitize_text_field'
	)
);

$wp_customize->add_control(
	'online_school_courses_banner_settings_upgraded_features', 
	array(
		'type'=> 'hidden',
		'description' => "
			<div class='customizer-upgraded-features'>
				<i class='fas fa-info-circle'></i>
				<span class='pro-text'>
					Unlock Premium <strong>Features</strong> ?<br>
					<a target='_blank' href='". esc_url(ONLINE_SCHOOL_COURSES_PREMIUM_PAGE) ." '>Upgrade Pro</a>
				</div>
			</div>
		",
		'section' => 'online_school_courses_banner_section'
	)
);
