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

$wp_customize->add_section(
	'design_studio_banner_section',
	array(
		'panel'    => 'design_studio_front_page_options',
		'title'    => esc_html__( 'Banner Section', 'design-studio' ),
		'priority' => 10,
	)
);

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

$wp_customize->add_control(
	new Design_Studio_Toggle_Switch_Custom_Control(
		$wp_customize,
		'design_studio_enable_banner_section',
		array(
			'label'    => esc_html__( 'Enable Banner Section', 'design-studio' ),
			'section'  => 'design_studio_banner_section',
			'settings' => 'design_studio_enable_banner_section',
		)
	)
);

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

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

$wp_customize->add_control(
	'design_studio_banner_section_heading',
	array(
		'label'           => sprintf( esc_html__( 'Main Heading One Word', 'design-studio' )),
		'section'         => 'design_studio_banner_section',
		'settings'        => 'design_studio_banner_section_heading',
		'type'            => 'text',
		'active_callback' => 'design_studio_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(
	'design_studio_banner_section_content',
	array(
		'label'           => sprintf( esc_html__( 'Subtitle Text (Bar)', 'design-studio' )),
		'section'         => 'design_studio_banner_section',
		'settings'        => 'design_studio_banner_section_content',
		'type'            => 'text',
		'active_callback' => 'design_studio_is_banner_slider_section_enabled',
	)
);

// Banner Section - Banner Description.
$wp_customize->add_setting(
	'design_studio_banner_section_description',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_textarea_field',
	)
);

$wp_customize->add_control(
	'design_studio_banner_section_description',
	array(
		'label'           => sprintf( esc_html__( 'Description Text', 'design-studio' )),
		'section'         => 'design_studio_banner_section',
		'settings'        => 'design_studio_banner_section_description',
		'type'            => 'text',
		'active_callback' => 'design_studio_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(
	'design_studio_banner_button_label_',
	array(
		'label'           => sprintf( esc_html__( 'Button Text', 'design-studio' )),
		'section'         => 'design_studio_banner_section',
		'settings'        => 'design_studio_banner_button_label_',
		'type'            => 'text',
		'active_callback' => 'design_studio_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(
	'design_studio_banner_button_link_' ,
	array(
		'label'           => sprintf( esc_html__( 'Button Link', 'design-studio' )  ),
		'section'         => 'design_studio_banner_section',
		'settings'        => 'design_studio_banner_button_link_' ,
		'type'            => 'url',
		'active_callback' => 'design_studio_is_banner_slider_section_enabled',
	)
);

$wp_customize->add_setting('design_studio_banner_section_image', array(
	'default' => get_template_directory_uri() . '/resource/img/default1.png',
    'sanitize_callback' => 'esc_url_raw',
));

$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'design_studio_banner_section_image', array(
    'label' => __('Banner Image', 'design-studio'),
    'section' => 'design_studio_banner_section',
	'active_callback' => 'design_studio_is_banner_slider_section_enabled',
)));



// Discount Percentage
$wp_customize->add_setting('design_studio_banner_discount', [
	'default' => '',
    'sanitize_callback' => 'sanitize_text_field'
]);

$wp_customize->add_control('design_studio_banner_discount', [
	'label' => __('Experience Years', 'design-studio'),
    'section' => 'design_studio_banner_section',
    'type' => 'text',
	'active_callback' => 'design_studio_is_banner_slider_section_enabled',
]);

// Discount Label (UP TO)
$wp_customize->add_setting('design_studio_banner_discount_label', [
	'default' => '',
    'sanitize_callback' => 'sanitize_text_field'
]);

$wp_customize->add_control('design_studio_banner_discount_label', [
    'label' => __('Experience Years Text', 'design-studio'),
    'section' => 'design_studio_banner_section',
    'type' => 'text',
	'active_callback' => 'design_studio_is_banner_slider_section_enabled',
]);

// Discount OFF text
$wp_customize->add_setting('design_studio_banner_discount_off', [
	'default' => '',
    'sanitize_callback' => 'sanitize_text_field'
]);

$wp_customize->add_control('design_studio_banner_discount_off', [
    'label' => __('Projects Done Text', 'design-studio'),
    'section' => 'design_studio_banner_section',
    'type' => 'text',
	'active_callback' => 'design_studio_is_banner_slider_section_enabled',
]);

// Secondary stat label text.
$wp_customize->add_setting(
	'design_studio_banner_secondary_stat_label',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'design_studio_banner_secondary_stat_label',
	array(
		'label'           => __( 'Projects Done Text', 'design-studio' ),
		'section'         => 'design_studio_banner_section',
		'type'            => 'text',
		'active_callback' => 'design_studio_is_banner_slider_section_enabled',
	)
);

// Floating card value.
$wp_customize->add_setting(
	'design_studio_banner_badge_value',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'design_studio_banner_badge_value',
	array(
		'label'           => __( 'Floating Card Value', 'design-studio' ),
		'section'         => 'design_studio_banner_section',
		'type'            => 'text',
		'active_callback' => 'design_studio_is_banner_slider_section_enabled',
	)
);

// Floating card label.
$wp_customize->add_setting(
	'design_studio_banner_badge_label',
	array(
		'default'           => '',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'design_studio_banner_badge_label',
	array(
		'label'           => __( 'Floating Card Label', 'design-studio' ),
		'section'         => 'design_studio_banner_section',
		'type'            => 'text',
		'active_callback' => 'design_studio_is_banner_slider_section_enabled',
	)
);

// Floating card plus icon text.
$wp_customize->add_setting(
	'design_studio_banner_badge_plus',
	array(
		'default'           => '+',
		'sanitize_callback' => 'sanitize_text_field',
	)
);

$wp_customize->add_control(
	'design_studio_banner_badge_plus',
	array(
		'label'           => __( 'Floating Card Plus Text', 'design-studio' ),
		'section'         => 'design_studio_banner_section',
		'type'            => 'text',
		'active_callback' => 'design_studio_is_banner_slider_section_enabled',
	)
);

// Floating card images (4 avatars)
for ( $i = 1; $i <= 4; $i++ ) {

	$wp_customize->add_setting(
		'design_studio_banner_badge_image_' . $i,
		array(
			'default'           => '',
			'sanitize_callback' => 'esc_url_raw',
		)
	);

	$wp_customize->add_control(
		new WP_Customize_Image_Control(
			$wp_customize,
			'design_studio_banner_badge_image_' . $i,
			array(
				/* translators: %d = image number */
				'label'           => sprintf( __( 'Floating Card Image %d', 'design-studio' ), $i ),
				'section'         => 'design_studio_banner_section',
				'active_callback' => 'design_studio_is_banner_slider_section_enabled',
			)
		)
	);
}

// Banner Button Label Color
$wp_customize->add_setting(
	'design_studio_banner_btn_color',
	array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'design_studio_banner_btn_color',array(
			'label' => __('Banner Button Label Color','design-studio'),
			'section' => 'design_studio_banner_section',
			'settings' => 'design_studio_banner_btn_color',
			'active_callback' => 'design_studio_is_banner_slider_section_enabled',
		)
	)
);

// Banner Button Background Color
$wp_customize->add_setting('design_studio_banner_btn_bg_color',array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'design_studio_banner_btn_bg_color',array(
			'label' => __('Banner Button Background Color','design-studio'),
			'section' => 'design_studio_banner_section',
			'settings' => 'design_studio_banner_btn_bg_color',
			'active_callback' => 'design_studio_is_banner_slider_section_enabled',
		)
	)
);
// Banner Button Border Color
$wp_customize->add_setting(
	'design_studio_banner_btn_border_color',array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'design_studio_banner_btn_border_color',array(
			'label' => __('Banner Button Border Color','design-studio'),
			'section' => 'design_studio_banner_section',
			'settings' => 'design_studio_banner_btn_border_color',
			'active_callback' => 'design_studio_is_banner_slider_section_enabled',
		)
	)
);


