<?php
/**
 * About Section options
 *
 * @package Theme Palace
 * @subpackage Charity Give
 * @since Charity Give 1.0.0
 */

// Add About section
$wp_customize->add_section( 'charity_give_featured_section', array(
	'title'             => esc_html__( 'Featured','charity-give' ),
	'description'       => esc_html__( 'featured Section options.', 'charity-give' ),
	'panel'             => 'charity_give_front_page_panel',
) );

// About content enable control and setting
$wp_customize->add_setting( 'charity_give_theme_options[featured_section_enable]', array(
	'default'			=> 	$options['featured_section_enable'],
	'sanitize_callback' => 'charity_give_sanitize_switch_control',
) );

$wp_customize->add_control( new Charity_Give_Switch_Control( $wp_customize, 'charity_give_theme_options[featured_section_enable]', array(
	'label'             => esc_html__( 'Featured Section Enable', 'charity-give' ),
	'section'           => 'charity_give_featured_section',
	'on_off_label' 		=> charity_give_switch_options(),
) ) );

if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'charity_give_theme_options[featured_section_enable]', array(
		'selector'      => '#charity_give_featured_section .tooltiptext',
		'settings'      => 'charity_give_theme_options[featured_section_enable]',
    ) );
}

// featured title setting and control
$wp_customize->add_setting( 'charity_give_theme_options[featured_title]', array(
	'sanitize_callback' => 'sanitize_text_field',
	'default'			=> $options['featured_title'],
	'transport'			=> 'postMessage',
) );

$wp_customize->add_control( 'charity_give_theme_options[featured_title]', array(
	'label'           	=> esc_html__( 'Title', 'charity-give' ),
	'section'        	=> 'charity_give_featured_section',
	'active_callback' 	=> 'charity_give_is_featured_section_enable',
	'type'				=> 'text',
) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
	$wp_customize->selective_refresh->add_partial( 'charity_give_theme_options[featured_title]', array(
		'selector'            => '#charity_give_featured_section .section-header h2',
		'settings'            => 'charity_give_theme_options[featured_title]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'charity_give_featured_title_partial',
		) );
}


// featured description setting and control
$wp_customize->add_setting( 'charity_give_theme_options[featured_description]', array(
	'sanitize_callback' => 'wp_kses_post',
	'default'			=> $options['featured_description'],
	'transport'			=> 'postMessage',
) );

$wp_customize->add_control( 'charity_give_theme_options[featured_description]', array(
	'label'           	=> esc_html__( 'Description', 'charity-give' ),
	'section'        	=> 'charity_give_featured_section',
	'active_callback' 	=> 'charity_give_is_featured_section_enable',
	'type'				=> 'textarea',
) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
	$wp_customize->selective_refresh->add_partial( 'charity_give_theme_options[featured_description]', array(
		'selector'            => '#charity_give_featured_section .section-header p',
		'settings'            => 'charity_give_theme_options[featured_description]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'charity_give_featured_description_partial',
		) );
}

// weekly_special title setting and control
$wp_customize->add_setting( 'charity_give_theme_options[featured_btn_text]', array(
	'sanitize_callback' => 'sanitize_text_field',
	'default'			=> $options['featured_btn_text'],
	'transport'			=> 'postMessage',
	) );

$wp_customize->add_control( 'charity_give_theme_options[featured_btn_text]', array(
	'label'           	=> esc_html__( 'Button Label', 'charity-give' ),
	'section'        	=> 'charity_give_featured_section',
	'active_callback' 	=> 'charity_give_is_featured_section_enable',
	'type'				=> 'text',
	) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
	$wp_customize->selective_refresh->add_partial( 'charity_give_theme_options[featured_btn_text]', array(
		'selector'            => '#charity_give_featured_section .read-more .btn',
		'settings'            => 'charity_give_theme_options[featured_btn_text]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'charity_give_featured_btn_text_partial',
		) );
}

$wp_customize->add_setting( 'charity_give_theme_options[featured_btn_url]',
	array(
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control( 'charity_give_theme_options[featured_btn_url]',
	array(
		'label'           	=>  esc_html__( 'Button Url ', 'charity-give' ),
		'section'        	=> 'charity_give_featured_section',
		'active_callback' 	=> 'charity_give_is_featured_section_enable',
		'type'				=> 'url',
	)
);