<?php
/**
 * Banner Section
 *
 * @package jewelry_accessories
 */

$wp_customize->add_section(
	'jewelry_accessories_banner_section',
	array(
		'panel'    => 'jewelry_accessories_front_page_options',
		'title'    => esc_html__( 'Banner Section', 'jewelry-accessories' ),
		'priority' => 10,
	)
);

// Banner Section - Enable Section.
$wp_customize->add_setting(
	'jewelry_accessories_enable_banner_section',
	array(
		'default'           => false,
		'sanitize_callback' => 'jewelry_accessories_sanitize_switch',
	)
);

$wp_customize->add_control(
	new Jewelry_Accessories_Toggle_Switch_Custom_Control(
		$wp_customize,
		'jewelry_accessories_enable_banner_section',
		array(
			'label'    => esc_html__( 'Enable Banner Section', 'jewelry-accessories' ),
			'section'  => 'jewelry_accessories_banner_section',
			'settings' => 'jewelry_accessories_enable_banner_section',
		)
	)
);

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

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

$wp_customize->add_control(
	'jewelry_accessories_banner_section_heading',
	array(
		'label'           => sprintf( esc_html__( 'Banner Heading', 'jewelry-accessories' )),
		'section'         => 'jewelry_accessories_banner_section',
		'settings'        => 'jewelry_accessories_banner_section_heading',
		'type'            => 'text',
		'active_callback' => 'jewelry_accessories_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(
	'jewelry_accessories_banner_section_content',
	array(
		'label'           => sprintf( esc_html__( 'Banner Content', 'jewelry-accessories' )),
		'section'         => 'jewelry_accessories_banner_section',
		'settings'        => 'jewelry_accessories_banner_section_content',
		'type'            => 'text',
		'active_callback' => 'jewelry_accessories_is_banner_slider_section_enabled',
	)
);

// Banner Section - Button Label.
$wp_customize->add_setting(
	'jewelry_accessories_banner_button_label_',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'jewelry_accessories_banner_button_label_',
	array(
		'label'           => sprintf( esc_html__( 'Button Label', 'jewelry-accessories' )),
		'section'         => 'jewelry_accessories_banner_section',
		'settings'        => 'jewelry_accessories_banner_button_label_',
		'type'            => 'text',
		'active_callback' => 'jewelry_accessories_is_banner_slider_section_enabled',
	)
);

// Banner Section - Button Link.
$wp_customize->add_setting(
	'jewelry_accessories_banner_button_link_' ,
	array(
		'default'           => '',
		'sanitize_callback' => 'esc_url_raw',
	)
);

$wp_customize->add_control(
	'jewelry_accessories_banner_button_link_' ,
	array(
		'label'           => sprintf( esc_html__( 'Button Link', 'jewelry-accessories' )  ),
		'section'         => 'jewelry_accessories_banner_section',
		'settings'        => 'jewelry_accessories_banner_button_link_' ,
		'type'            => 'url',
		'active_callback' => 'jewelry_accessories_is_banner_slider_section_enabled',
	)
);

$wp_customize->add_setting('jewelry_accessories_banner_section_image', array(
    'default' => '',
    'sanitize_callback' => 'esc_url_raw',
));

$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'jewelry_accessories_banner_section_image', array(
    'label' => __('Banner Image', 'jewelry-accessories'),
    'section' => 'jewelry_accessories_banner_section',
	'active_callback' => 'jewelry_accessories_is_banner_slider_section_enabled',
)));

// Banner Section - Banner Right Title.
$wp_customize->add_setting(
	'jewelry_accessories_banner_right_title',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'jewelry_accessories_banner_right_title',
	array(
		'label'           => sprintf( esc_html__( 'Banner Right Title', 'jewelry-accessories' )),
		'section'         => 'jewelry_accessories_banner_section',
		'settings'        => 'jewelry_accessories_banner_right_title',
		'type'            => 'text',
		'active_callback' => 'jewelry_accessories_is_banner_slider_section_enabled',
	)
);

$wp_customize->add_setting('jewelry_accessories_banner_second_image', array(
    'default' => '',
    'sanitize_callback' => 'esc_url_raw',
));

$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'jewelry_accessories_banner_second_image', array(
    'label' => __('Banner Right Image', 'jewelry-accessories'),
    'section' => 'jewelry_accessories_banner_section',
	'active_callback' => 'jewelry_accessories_is_banner_slider_section_enabled',
)));

// Banner Section - Banner Image Title.
$wp_customize->add_setting(
	'jewelry_accessories_banner_image_title',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'jewelry_accessories_banner_image_title',
	array(
		'label'           => sprintf( esc_html__( 'Banner Image Title', 'jewelry-accessories' )),
		'section'         => 'jewelry_accessories_banner_section',
		'settings'        => 'jewelry_accessories_banner_image_title',
		'type'            => 'text',
		'active_callback' => 'jewelry_accessories_is_banner_slider_section_enabled',
	)
);

// Banner Button Label Color
$wp_customize->add_setting(
	'jewelry_accessories_banner_btn_color',
	array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'jewelry_accessories_banner_btn_color',array(
			'label' => __('Banner Button Label Color','jewelry-accessories'),
			'section' => 'jewelry_accessories_banner_section',
			'settings' => 'jewelry_accessories_banner_btn_color',
			'active_callback' => 'jewelry_accessories_is_banner_slider_section_enabled',
		)
	)
);

// Banner Button Background Color
$wp_customize->add_setting('jewelry_accessories_banner_btn_bg_color',array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'jewelry_accessories_banner_btn_bg_color',array(
			'label' => __('Banner Button Background Color','jewelry-accessories'),
			'section' => 'jewelry_accessories_banner_section',
			'settings' => 'jewelry_accessories_banner_btn_bg_color',
			'active_callback' => 'jewelry_accessories_is_banner_slider_section_enabled',
		)
	)
);


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

$wp_customize->add_control(
	'jewelry_accessories_banner_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(JEWELRY_ACCESSORIES_PREMIUM_PAGE) ." '>Upgrade Pro</a>
				</div>
			</div>
		",
		'section' => 'jewelry_accessories_banner_section'
	)
);