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

$wp_customize->add_section(
	'property_dealer_banner_section',
	array(
		'panel'    => 'property_dealer_front_page_options',
		'title'    => esc_html__( 'Banner Section', 'property-dealer' ),
		'priority' => 10,
	)
);

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

$wp_customize->add_control(
	new Property_Dealer_Toggle_Switch_Custom_Control(
		$wp_customize,
		'property_dealer_enable_banner_section',
		array(
			'label'    => esc_html__( 'Enable Banner Section', 'property-dealer' ),
			'section'  => 'property_dealer_banner_section',
			'settings' => 'property_dealer_enable_banner_section',
		)
	)
);

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

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

$wp_customize->add_control(
	'property_dealer_banner_section_heading',
	array(
		'label'           => sprintf( esc_html__( 'Banner Heading', 'property-dealer' )),
		'section'         => 'property_dealer_banner_section',
		'settings'        => 'property_dealer_banner_section_heading',
		'type'            => 'text',
		'active_callback' => 'property_dealer_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(
	'property_dealer_banner_section_content',
	array(
		'label'           => sprintf( esc_html__( 'Banner Content', 'property-dealer' )),
		'section'         => 'property_dealer_banner_section',
		'settings'        => 'property_dealer_banner_section_content',
		'type'            => 'text',
		'active_callback' => 'property_dealer_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'property_dealer_banner_section_image', array(
    'label' => __('Banner Image', 'property-dealer'),
    'section' => 'property_dealer_banner_section',
	'active_callback' => 'property_dealer_is_banner_slider_section_enabled',
)));

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

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