<?php
/**
 * Video Call To Action Section
*/
$wp_customize->add_section(new constructionarc_Toggle_Section($wp_customize, 'constructionarc_video_calltoaction_section', array(
	'title'		=> 	esc_html__('Video Call To Action Section','construction-arc'),
	'panel'		=> 'constructionarc_frontpage_settings',
	'priority'  => constructionarc_themes_get_section_position('constructionarc_video_calltoaction_section'),
	'hiding_control' => 'constructionarc_videcta_disable'
)));

//ENABLE/DISABLE VIDEO CALL TO ACTION SECTION
$wp_customize->add_setting('constructionarc_videcta_disable', array(
	'default' => 'enable',
	'transport' => 'postMessage',
	'sanitize_callback' => 'constructionarc_themes_sanitize_switch',    
));
$wp_customize->add_control(new constructionarc_Switch_Control($wp_customize, 'constructionarc_videcta_disable', array(
	'label' => esc_html__('Section', 'construction-arc'),
	'section' => 'constructionarc_video_calltoaction_section',
	'switch_label' => array(
		'enable' => esc_html__('Enable', 'construction-arc'),
		'disable' => esc_html__('Disable', 'construction-arc'),
	),
	'class' => 'switch-section',
    'priority' => -1,
)));

	$wp_customize->add_setting('constructionarc_video_calltoaction_section_nav', array(
		'transport' => 'postMessage',
		'sanitize_callback' => 'wp_kses_post',
	));
	$wp_customize->add_control( new constructionarc_Custom_Control_Tab( $wp_customize, 'constructionarc_video_calltoaction_section_nav', array(
		'type' => 'tab',
		'section' => 'constructionarc_video_calltoaction_section',
		'priority' => 1,
		'buttons' => array(
			array(
				'name' => esc_html__('Content', 'construction-arc'),
				'fields' => array(
					'constructionarc_video_cta_layout',
					'constructionarc_video_button_url',
					'constructionarc_video_calltoaction_video_bg',
					'constructionarc_appointment_contact_title',
					'constructionarc_appointment_shortcode',
					'constructionarc_video_calltoaction_height',
				),
				'active' => true,
			),
			array(
				'name' => esc_html__('Style', 'construction-arc'),
				'fields' => array(
					'constructionarc_video_calltoaction_box_bg_color'
				),
			),
			array(
				'name' => esc_html__('Advanced', 'construction-arc'),
				'fields' => array(
					'constructionarc_video_calltoaction_bg_type',
					'constructionarc_video_calltoaction_bg_color',
					'constructionarc_video_calltoaction_bg_image',
					'constructionarc_video_calltoaction_overlay_color',
					'constructionarc_video_calltoaction_padding',
					'constructionarc_video_calltoaction_cs_seperator',
				),
			)
		)
	)));

	$wp_customize->add_setting('constructionarc_video_cta_layout', array(
        'default' => 'video-cta-top',
        'sanitize_callback' => 'constructionarc_themes_sanitize_select',
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control(
        new constructionarc_Custom_Control_Buttonset( $wp_customize, 'constructionarc_video_cta_layout',
            array(
                'choices'  => array(
                    'video-cta-left' => esc_html__('Left', 'construction-arc'),
                    'video-cta-right' => esc_html__('Right', 'construction-arc'),
                    'video-cta-top' => esc_html__('Top', 'construction-arc'),
                    'video-cta-below' => esc_html__('Below', 'construction-arc'),
                ),
                'label'    => esc_html__( 'Display Position', 'construction-arc' ),
                'section'  => 'constructionarc_video_calltoaction_section',
            )
        )
    );

	$wp_customize->add_setting('constructionarc_video_button_url', array(
		'transport' => 'postMessage',
		'sanitize_callback'	=> 'esc_url_raw',
		'default' => 'https://www.youtube.com/watch?v=1IaZy0sDLu0',		
	));
	$wp_customize->add_control('constructionarc_video_button_url', array(
		'label'	   => esc_html__('Youtube Video URL','construction-arc'),
		'section'  => 'constructionarc_video_calltoaction_section',
		'type'	   => 'url'
	));

	$wp_customize->add_setting( 'constructionarc_video_calltoaction_video_bg', array(
		'sanitize_callback' => 'esc_url_raw', 	 	
		'transport' => 'postMessage',
		'default' => get_template_directory_uri() . '/assets/images/bg.jpg',
	));
	$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'constructionarc_video_calltoaction_video_bg', array(
		'label'	   => esc_html__('Video Background Image','construction-arc'),
		'section'  => 'constructionarc_video_calltoaction_section',
	)));

	$wp_customize->add_setting('constructionarc_appointment_contact_title', array(
        'sanitize_callback' => 'sanitize_text_field',
        'default' => esc_html__('Get in Touch Quickly', 'construction-arc'),
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control('constructionarc_appointment_contact_title', array(
        'section' => 'constructionarc_video_calltoaction_section',
        'type' => 'text',
        'label' => esc_html__('Contact Title', 'construction-arc')
    ));
	
	$wp_customize->add_setting('constructionarc_appointment_shortcode', array(
		'transport' => 'postMessage',
		'sanitize_callback'	=> 'sanitize_text_field'		
	));
	$wp_customize->add_control('constructionarc_appointment_shortcode', array(
		'label'	   => esc_html__('Shortcode','construction-arc'),
		'description' => sprintf(esc_html__('Install %s plugin to get the shortcode or you can use any shortcode', 'construction-arc'), '<a target="_blank" href="https://wordpress.org/plugins/contact-form-7/">Contact Form 7</a>'),
		'section'  => 'constructionarc_video_calltoaction_section',
		'type'	   => 'text',
	));

	$wp_customize->add_setting('constructionarc_video_calltoaction_height', array(
		'sanitize_callback' => 'absint',
		'default' => 450,
		'transport' => 'postMessage'
	));
	$wp_customize->add_control(new constructionarc_Themes_Range_Control($wp_customize, 'constructionarc_video_calltoaction_height', array(
		'section' => 'constructionarc_video_calltoaction_section',
		'label' => esc_html__('Video Call To Action Height (px)', 'construction-arc'),
		'input_attrs' => array(
			'min' => 300,
			'max' => 900,
			'step' => 1
		)
	)));

	$wp_customize->add_setting("constructionarc_video_calltoaction_box_bg_color", array(
        'default' => '',
        'sanitize_callback' => 'constructionarc_themes_sanitize_color_alpha',
        'transport' => 'postMessage'
    ));
    $wp_customize->add_control(new constructionarc_Alpha_Color_Control($wp_customize, "constructionarc_video_calltoaction_box_bg_color", array(
        'section' => "constructionarc_video_calltoaction_section",
        'label' => esc_html__('Background Color', 'construction-arc'),
        'priority' => 54
    )));

	$wp_customize->add_setting('constructionarc_pro_video_calltoaction', array(
        'sanitize_callback' => 'constructionarc_sanitize_text'
    ));
    $wp_customize->add_control(new constructionarc_Themes_Upgrade_Text($wp_customize, 'constructionarc_pro_video_calltoaction', array(
        'section' => 'constructionarc_video_calltoaction_section',
        'label' => esc_html__('For More Settings,', 'construction-arc'),
        'choices' => array(
            esc_html__('Different Layout & Settings', 'construction-arc'),
            esc_html__('(5+) Different Section Title Style', 'construction-arc'),
            esc_html__('Advanced Services Items Settings', 'construction-arc'),
            esc_html__('Title, sub title & text color options', 'construction-arc'),
			esc_html__('4+ Different Background Options( Color/Video/Gradient/Image ) ', 'construction-arc'),
			esc_html__('More Than 35+ Top & Bottom Separator Shape Illustrator with Color & Height Option', 'construction-arc'),
        ),
        'priority' => 250,
    )));

$wp_customize->selective_refresh->add_partial( "constructionarc_video_cta_refresh", array (
	'settings' => array(
		'constructionarc_videcta_disable',
		'constructionarc_video_cta_layout',
		'constructionarc_video_button_url',
		'constructionarc_video_calltoaction_video_bg',
		'constructionarc_appointment_contact_title',
		'constructionarc_appointment_shortcode',
	),
	'selector' => "#video_calltoaction-section",
	'fallback_refresh' => true,
	'container_inclusive' => true,
	'render_callback' => function () {
		return get_template_part( 'section/section-video_calltoaction' );
	}
));