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

$wp_customize->add_section(
	'handmade_craft_banner_section',
	array(
		'panel'    => 'handmade_craft_front_page_options',
		'title'    => esc_html__( 'Banner Section', 'handmade-craft' ),
		'priority' => 10,
	)
);

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

$wp_customize->add_control(
	new Handmade_Craft_Toggle_Switch_Custom_Control(
		$wp_customize,
		'handmade_craft_enable_banner_section',
		array(
			'label'    => esc_html__( 'Enable Banner Section', 'handmade-craft' ),
			'section'  => 'handmade_craft_banner_section',
			'settings' => 'handmade_craft_enable_banner_section',
		)
	)
);

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

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

$wp_customize->add_control(
	'handmade_craft_banner_section_sub_heading',
	array(
		'label'           => sprintf( esc_html__( 'Banner Sub Heading', 'handmade-craft' )),
		'section'         => 'handmade_craft_banner_section',
		'settings'        => 'handmade_craft_banner_section_sub_heading',
		'type'            => 'text',
		'active_callback' => 'handmade_craft_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(
	'handmade_craft_banner_section_heading',
	array(
		'label'           => sprintf( esc_html__( 'Banner Heading', 'handmade-craft' )),
		'section'         => 'handmade_craft_banner_section',
		'settings'        => 'handmade_craft_banner_section_heading',
		'type'            => 'text',
		'active_callback' => 'handmade_craft_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(
	'handmade_craft_banner_section_content',
	array(
		'label'           => sprintf( esc_html__( 'Banner Content', 'handmade-craft' )),
		'section'         => 'handmade_craft_banner_section',
		'settings'        => 'handmade_craft_banner_section_content',
		'type'            => 'text',
		'active_callback' => 'handmade_craft_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(
	'handmade_craft_banner_button_label_one',
	array(
		'label'           => sprintf( esc_html__( 'Button Label 1', 'handmade-craft' )),
		'section'         => 'handmade_craft_banner_section',
		'settings'        => 'handmade_craft_banner_button_label_one',
		'type'            => 'text',
		'active_callback' => 'handmade_craft_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(
	'handmade_craft_banner_button_link_one' ,
	array(
		'label'           => sprintf( esc_html__( 'Button Link 1', 'handmade-craft' )  ),
		'section'         => 'handmade_craft_banner_section',
		'settings'        => 'handmade_craft_banner_button_link_one' ,
		'type'            => 'url',
		'active_callback' => 'handmade_craft_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(
	'handmade_craft_banner_button_label_two',
	array(
		'label'           => sprintf( esc_html__( 'Button Label 2', 'handmade-craft' )),
		'section'         => 'handmade_craft_banner_section',
		'settings'        => 'handmade_craft_banner_button_label_two',
		'type'            => 'text',
		'active_callback' => 'handmade_craft_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(
	'handmade_craft_banner_button_link_two' ,
	array(
		'label'           => sprintf( esc_html__( 'Button Link 2', 'handmade-craft' )  ),
		'section'         => 'handmade_craft_banner_section',
		'settings'        => 'handmade_craft_banner_button_link_two' ,
		'type'            => 'url',
		'active_callback' => 'handmade_craft_is_banner_slider_section_enabled',
	)
);

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

$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'handmade_craft_banner_section_image', array(
    'label' => __('Banner Image', 'handmade-craft'),
    'section' => 'handmade_craft_banner_section',
	'active_callback' => 'handmade_craft_is_banner_slider_section_enabled',
)));

// Banner Button Label Color
$wp_customize->add_setting(
	'handmade_craft_banner_btn_color',
	array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'handmade_craft_banner_btn_color',array(
			'label' => __('Banner Button Label Color','handmade-craft'),
			'section' => 'handmade_craft_banner_section',
			'settings' => 'handmade_craft_banner_btn_color',
			'active_callback' => 'handmade_craft_is_banner_slider_section_enabled',
		)
	)
);

// Banner Button Background Color
$wp_customize->add_setting('handmade_craft_banner_btn_bg_color',array(
		'default' => '',
		'sanitize_callback' => 'sanitize_hex_color',
	)
);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize,'handmade_craft_banner_btn_bg_color',array(
			'label' => __('Banner Button Background Color','handmade-craft'),
			'section' => 'handmade_craft_banner_section',
			'settings' => 'handmade_craft_banner_btn_bg_color',
			'active_callback' => 'handmade_craft_is_banner_slider_section_enabled',
		)
	)
);