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

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

// Properties Section - Enable Section.
$wp_customize->add_setting(
	'property_dealer_enable_properties_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_properties_section',
		array(
			'label'    => esc_html__( 'Enable Properties Section', 'property-dealer' ),
			'section'  => 'property_dealer_properties_section',
			'settings' => 'property_dealer_enable_properties_section',
		)
	)
);

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

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

$wp_customize->add_control(
	'property_dealer_properties_section_heading',
	array(
		'label'           => sprintf( esc_html__( 'Properties Heading', 'property-dealer' )),
		'section'         => 'property_dealer_properties_section',
		'settings'        => 'property_dealer_properties_section_heading',
		'type'            => 'text',
		'active_callback' => 'property_dealer_is_properties_section_enabled',
	)
);

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

$wp_customize->add_control(
	'property_dealer_properties_section_content',
	array(
		'label'           => sprintf( esc_html__( 'Properties Content', 'property-dealer' )),
		'section'         => 'property_dealer_properties_section',
		'settings'        => 'property_dealer_properties_section_content',
		'type'            => 'text',
		'active_callback' => 'property_dealer_is_properties_section_enabled',
	)
);

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

$wp_customize->add_control(
	'property_dealer_properties_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_properties_section'
	)
);