<?php
/**
 * Subscription Section options
 *
 * @package Theme Palace
 * @subpackage Ultravel
 * @since Ultravel 1.0.0
 */

// Add Subscription section
$wp_customize->add_section( 'ultravel_subscribe_now_section', array(
	'title'             => esc_html__( 'Subscription','ultravel' ),
	'description'       => esc_html__( 'Note: To activate this section you need to install Jetpack Plugin and activate subscription module.', 'ultravel' ),
	'panel'             => 'ultravel_front_page_panel',
) );

// Subscription content enable control and setting
$wp_customize->add_setting( 'ultravel_theme_options[subscribe_now_section_enable]', array(
	'default'			=> 	$options['subscribe_now_section_enable'],
	'sanitize_callback' => 'ultravel_sanitize_switch_control',
) );

$wp_customize->add_control( new Ultravel_Switch_Control( $wp_customize, 'ultravel_theme_options[subscribe_now_section_enable]', array(
	'label'             => esc_html__( 'Subscription Section Enable', 'ultravel' ),
	'section'           => 'ultravel_subscribe_now_section',
	'on_off_label' 		=> ultravel_switch_options(),
) ) );

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

// subscription description setting and control
$wp_customize->add_setting( 'ultravel_theme_options[subscribe_now_sub_title]', array(
	'sanitize_callback' => 'sanitize_text_field',
	'default'			=> $options['subscribe_now_sub_title'],
	'transport'			=> 'postMessage',
) );

$wp_customize->add_control( 'ultravel_theme_options[subscribe_now_sub_title]', array(
	'label'           	=> esc_html__( 'Description', 'ultravel' ),
	'section'        	=> 'ultravel_subscribe_now_section',
	'active_callback' 	=> 'ultravel_is_subscribe_now_section_enable',
	'type'				=> 'textarea',
) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'ultravel_theme_options[subscribe_now_sub_title]', array(
		'selector'            => '#subscribe-now .section-header p.section-subtitle',
		'settings'            => 'ultravel_theme_options[subscribe_now_sub_title]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'ultravel_subscribe_now_section_sub_title_partial',
    ) );
}

// subscription description setting and control
$wp_customize->add_setting( 'ultravel_theme_options[subscribe_now_btn]', array(
	'sanitize_callback' => 'sanitize_text_field',
	'default'			=> $options['subscribe_now_btn'],
	'transport'			=> 'postMessage',
) );

$wp_customize->add_control( 'ultravel_theme_options[subscribe_now_btn]', array(
	'label'           	=> esc_html__( 'Button Label', 'ultravel' ),
	'section'        	=> 'ultravel_subscribe_now_section',
	'active_callback' 	=> 'ultravel_is_subscribe_now_section_enable',
	'type'				=> 'text',
) );

// Abort if selective refresh is not available.
if ( isset( $wp_customize->selective_refresh ) ) {
    $wp_customize->selective_refresh->add_partial( 'ultravel_theme_options[subscribe_now_btn]', array(
		'selector'            => '#subscribe-now .section-header p.section-subtitle',
		'settings'            => 'ultravel_theme_options[subscribe_now_btn]',
		'container_inclusive' => false,
		'fallback_refresh'    => true,
		'render_callback'     => 'ultravel_subscribe_now_section_btn_partial',
    ) );
}

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

$wp_customize->add_control( 'ultravel_theme_options[subscribe_now_title]', array(
	'label'           	=> esc_html__( 'Title', 'ultravel' ),
	'section'        	=> 'ultravel_subscribe_now_section',
	'active_callback' 	=> 'ultravel_is_subscribe_now_section_enable',
	'type'				=> 'text',
) );