<?php
/**
 * Video Section
 *
 * @package Charity_Elite
 */

$wp_customize->add_section(
	'charity_elite_video_section',
	array(
		'panel'    => 'charity_elite_front_page_options',
		'title'    => esc_html__( 'Video Section', 'charity-elite' ),
		'priority' => 70,
	)
);

// Video Section - Enable Section.
$wp_customize->add_setting(
	'charity_elite_enable_video_section',
	array(
		'default'           => false,
		'sanitize_callback' => 'charity_elite_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Charity_Elite_Toggle_Switch_Custom_Control(
		$wp_customize,
		'charity_elite_enable_video_section',
		array(
			'label'    => esc_html__( 'Enable Video Section', 'charity-elite' ),
			'section'  => 'charity_elite_video_section',
			'settings' => 'charity_elite_enable_video_section',
		)
	)
);

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

// Video Section - Background Image.
$wp_customize->add_setting(
	'charity_elite_video_section_bg_image',
	array(
		'sanitize_callback' => 'charity_elite_sanitize_image',
	)
);

$wp_customize->add_control(
	new WP_Customize_Image_Control(
		$wp_customize,
		'charity_elite_video_section_bg_image',
		array(
			'label'           => esc_html__( 'Background Image', 'charity-elite' ),
			'section'         => 'charity_elite_video_section',
			'settings'        => 'charity_elite_video_section_bg_image',
			'active_callback' => 'charity_elite_is_video_section_enabled',
		)
	)
);


// Video Section - Section Subtitle.
$wp_customize->add_setting(
	'charity_elite_video_subtitle',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'charity_elite_video_subtitle',
	array(
		'label'           => esc_html__( 'Section Subtitle', 'charity-elite' ),
		'section'         => 'charity_elite_video_section',
		'settings'        => 'charity_elite_video_subtitle',
		'type'            => 'text',
		'active_callback' => 'charity_elite_is_video_section_enabled',
	)
);


// Video Section - Section Title.
$wp_customize->add_setting(
	'charity_elite_video_title',
	array(
		'default'           => __( 'Watch the Video', 'charity-elite' ),
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'charity_elite_video_title',
	array(
		'label'           => esc_html__( 'Section Title', 'charity-elite' ),
		'section'         => 'charity_elite_video_section',
		'settings'        => 'charity_elite_video_title',
		'type'            => 'text',
		'active_callback' => 'charity_elite_is_video_section_enabled',
	)
);

// Video Section - Video Link.
$wp_customize->add_setting(
	'charity_elite_video_video_link',
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'charity_elite_video_video_link',
	array(
		'label'           => esc_html__( 'Video Link', 'charity-elite' ),
		'section'         => 'charity_elite_video_section',
		'settings'        => 'charity_elite_video_video_link',
		'type'            => 'url',
		'active_callback' => 'charity_elite_is_video_section_enabled',
	)
);
