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

$wp_customize->add_section(
	'charitable_funds_banner_section',
	array(
		'panel'    => 'charitable_funds_front_page_options',
		'title'    => esc_html__( 'Banner Section', 'charitable-funds' ),
		'priority' => 10,
	)
);

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

$wp_customize->add_control(
	new Charitable_Funds_Toggle_Switch_Custom_Control(
		$wp_customize,
		'charitable_funds_enable_banner_section',
		array(
			'label'    => esc_html__( 'Enable Banner Section', 'charitable-funds' ),
			'section'  => 'charitable_funds_banner_section',
			'settings' => 'charitable_funds_enable_banner_section',
		)
	)
);

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

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

$wp_customize->add_control(
	'charitable_funds_banner_section_heading',
	array(
		'label'           => sprintf( esc_html__( 'Banner Sub Heading', 'charitable-funds' )),
		'section'         => 'charitable_funds_banner_section',
		'settings'        => 'charitable_funds_banner_section_heading',
		'type'            => 'text',
		'active_callback' => 'charitable_funds_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(
	'charitable_funds_banner_section_content',
	array(
		'label'           => sprintf( esc_html__( 'Banner Heading', 'charitable-funds' )),
		'section'         => 'charitable_funds_banner_section',
		'settings'        => 'charitable_funds_banner_section_content',
		'type'            => 'text',
		'active_callback' => 'charitable_funds_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(
	'charitable_funds_banner_content',
	array(
		'label'           => sprintf( esc_html__( 'Banner Content', 'charitable-funds' )),
		'section'         => 'charitable_funds_banner_section',
		'settings'        => 'charitable_funds_banner_content',
		'type'            => 'text',
		'active_callback' => 'charitable_funds_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'charitable_funds_banner_section_image', array(
    'label' => __('Banner Image', 'charitable-funds'),
    'section' => 'charitable_funds_banner_section',
	'active_callback' => 'charitable_funds_is_banner_slider_section_enabled',
)));

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

$wp_customize->add_control(
	'charitable_funds_about_button_label_',
	array(
		'label'           => sprintf( esc_html__( 'Button Label', 'charitable-funds' )),
		'section'         => 'charitable_funds_banner_section',
		'settings'        => 'charitable_funds_about_button_label_',
		'type'            => 'text',
		'active_callback' => 'charitable_funds_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(
	'charitable_funds_about_button_link_' ,
	array(
		'label'           => sprintf( esc_html__( 'Button Link', 'charitable-funds' )  ),
		'section'         => 'charitable_funds_banner_section',
		'settings'        => 'charitable_funds_about_button_link_' ,
		'type'            => 'url',
		'active_callback' => 'charitable_funds_is_banner_slider_section_enabled',
	)
);

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

// Banner Button Label Color
$wp_customize->add_setting(
	'charitable_funds_banner_btn_color',
	array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'charitable_funds_banner_btn_color',array(
			'label' => __('Banner Button Label Color','charitable-funds'),
			'section' => 'charitable_funds_banner_section',
			'settings' => 'charitable_funds_banner_btn_color',
			'active_callback' => 'charitable_funds_is_banner_slider_section_enabled',
		)
	)
);

// Banner Button Background Color
$wp_customize->add_setting('charitable_funds_banner_btn_bg_color',array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'charitable_funds_banner_btn_bg_color',array(
			'label' => __('Banner Button Background Color','charitable-funds'),
			'section' => 'charitable_funds_banner_section',
			'settings' => 'charitable_funds_banner_btn_bg_color',
			'active_callback' => 'charitable_funds_is_banner_slider_section_enabled',
		)
	)
);

$wp_customize->add_control(
	'charitable_funds_about_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(CHARITABLE_FUNDS_PREMIUM_PAGE) ." '>Upgrade Pro</a>
				</div>
			</div>
		",
		'section' => 'charitable_funds_banner_section'
	)
);