<?php

/* -------------------------------------------------------------------------- */
/*                                  Slider 1                                  */
/* -------------------------------------------------------------------------- */

function kindrex_slider( $wp_customize ) {
	$wp_customize->add_section(
		'kindrex-slider-section',
		array(
			'title'       => esc_html__( 'Image Slider', 'kindrex' ),
			'description' => esc_html__( 'Set images and paragraph for the slider.', 'kindrex' ),
			'priority'    => '82',
		)
	);

	$wp_customize->add_setting(
		'kindrex-slider-display',
		array(
			'default'           => esc_html__( 'Yes', 'kindrex' ),
			'sanitize_callback' => 'kindrex_sanitize_html',
		)
	);

	$wp_customize->add_control(
		new WP_Customize_Control(
			$wp_customize,
			'kindrex-slider-display-control',
			array(
				'label'    => esc_html__( 'Display Slider Block?', 'kindrex' ),
				'section'  => 'kindrex-slider-section',
				'settings' => 'kindrex-slider-display',
				'type'     => 'select',
				'choices'  => array(
					'No'  => esc_html__( 'No', 'kindrex' ),
					'Yes' => esc_html__( 'Yes', 'kindrex' ),
				),
			)
		)
	);

	$wp_customize->add_setting(
		'kindrex-slider-display1',
		array(
			'default'           => esc_html__( 'Yes', 'kindrex' ),
			'sanitize_callback' => 'kindrex_sanitize_html',
		)
	);

	$wp_customize->add_control(
		new WP_Customize_Control(
			$wp_customize,
			'kindrex-slider-display1-control',
			array(
				'label'    => esc_html__( 'First Slide Active:', 'kindrex' ),
				'section'  => 'kindrex-slider-section',
				'settings' => 'kindrex-slider-display1',
				'type'     => 'select',
				'choices'  => array(
					'No'  => esc_html__( 'No', 'kindrex' ),
					'Yes' => esc_html__( 'Yes', 'kindrex' ),
				),
			)
		)
	);

	$wp_customize->add_setting(
		'kindrex-slider1-image',
		array(
			'sanitize_callback' => 'kindrex_sanitize_html',
		)
	);

	$wp_customize->add_control(
		new WP_Customize_Cropped_Image_Control(
			$wp_customize,
			'kindrex-slider1-image-control',
			array(
				'label'       => esc_html__( 'Image', 'kindrex' ),
				'description' => esc_html__( 'If there is no image, the slide will not appear in rotation.', 'kindrex' ),
				'section'     => 'kindrex-slider-section',
				'settings'    => 'kindrex-slider1-image',
				'height'      => 800,
				'width'       => 1300,
			)
		)
	);

	$wp_customize->add_setting(
		'kindrex-slider1-text',
		array(
			'default'           => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.', 'kindrex' ),
			'sanitize_callback' => 'kindrex_sanitize_html',
		)
	);

	$wp_customize->add_control(
		new WP_Customize_Control(
			$wp_customize,
			'kindrex-slider1-text-control', 
			array(
				'label'    => esc_html__( 'Text', 'kindrex' ),
				'section'  => 'kindrex-slider-section',
				'settings' => 'kindrex-slider1-text',
				'type'     => 'textarea',
			)
		)
	);

	$wp_customize->add_setting(
		'kindrex-slider1-link',
		array(
			'default'           => esc_html__( 'https://', 'kindrex' ),
			'sanitize_callback' => 'kindrex_sanitize_html',
		)
	);

	$wp_customize->add_control(
		new WP_Customize_Control(
			$wp_customize,
			'kindrex-slider1-link-control',
			array(
				'label'       => esc_html__( 'Paragraph Link', 'kindrex' ),
				'description' => esc_html__( 'When you set an address, the whole paragraph will be a link. MUST HAVE HTTPS:// for External Links. Erase to not have any linking.', 'kindrex' ),
				'section'     => 'kindrex-slider-section',
				'settings'    => 'kindrex-slider1-link',
				'type'        => 'url',
			)
		)
	);

	/* -------------------------------------------------------------------------- */
	/*                                  Slider 2                                  */
	/* -------------------------------------------------------------------------- */

	$wp_customize->add_setting(
		'kindrex-slider-display2',
		array(
			'default'           => esc_html__( 'Yes', 'kindrex' ),
			'sanitize_callback' => 'kindrex_sanitize_html',
		)
	);

	$wp_customize->add_control(
		new WP_Customize_Control(
			$wp_customize,
			'kindrex-slider-display2-control',
			array(
				'label'    => esc_html__( 'Second Slide Active:', 'kindrex' ),
				'section'  => 'kindrex-slider-section',
				'settings' => 'kindrex-slider-display2',
				'type'     => 'select',
				'choices'  => array(
					'No'  => esc_html__( 'No', 'kindrex' ),
					'Yes' => esc_html__( 'Yes', 'kindrex' ),
				),
			)
		)
	);

	$wp_customize->add_setting(
		'kindrex-slider2-image',
		array(
			'sanitize_callback' => 'kindrex_sanitize_html',
		)
	);

	$wp_customize->add_control(
		new WP_Customize_Cropped_Image_Control(
			$wp_customize,
			'kindrex-slider2-image-control',
			array(
				'label'       => esc_html__( 'Image', 'kindrex' ),
				'description' => esc_html__( 'If there is no image, the slide will not appear in rotation.', 'kindrex' ),
				'section'     => 'kindrex-slider-section',
				'settings'    => 'kindrex-slider2-image',
				'height'      => 800,
				'width'       => 1300,
			)
		)
	);

	$wp_customize->add_setting(
		'kindrex-slider2-text',
		array(
			'default'           => esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.', 'kindrex' ),
			'sanitize_callback' => 'kindrex_sanitize_html',
		)
	);

	$wp_customize->add_control(
		new WP_Customize_Control(
			$wp_customize,
			'kindrex-slider2-text-control', 
			array(
				'label'    => esc_html__( 'Text', 'kindrex' ),
				'section'  => 'kindrex-slider-section',
				'settings' => 'kindrex-slider2-text',
				'type'     => 'textarea',
			)
		)
	);

	$wp_customize->add_setting(
		'kindrex-slider2-link',
		array(
			'default'           => esc_html__( 'https://', 'kindrex' ),
			'sanitize_callback' => 'kindrex_sanitize_html',
		)
	);

	$wp_customize->add_control(
		new WP_Customize_Control(
			$wp_customize,
			'kindrex-slider2-link-control',
			array(
				'label'       => esc_html__( 'Paragraph Link', 'kindrex' ),
				'description' => esc_html__( 'When you set an address, the whole paragraph will be a link. MUST HAVE HTTPS:// for External Links. Erase to not have any linking.', 'kindrex' ),
				'section'     => 'kindrex-slider-section',
				'settings'    => 'kindrex-slider2-link',
				'type'        => 'url',
			)
		)
	);

	/* -------------------------------------------------------------------------- */
	/*                                  Slider 3                                  */
	/* -------------------------------------------------------------------------- */

	$wp_customize->add_control(
		'label-is3',
		array(
			'type'        => 'button',
			'settings'    => array(),
			'label'       => __( 'Third Slide Active?', 'kindrex' ),
			'priority'    => 10,
			'section'     => 'kindrex-slider-section',
			'input_attrs' => array(
				'value'   => __( 'Get pro for this feature!', 'kindrex' ),
				'class'   => 'button-secondary',
				'onclick' => "window.open('https://www.designwicked.com/store/premium-kindrex', '_blank')",
			),
		)
	);

	/* -------------------------------------------------------------------------- */
	/*                                  Slider 4                                  */
	/* -------------------------------------------------------------------------- */

	$wp_customize->add_control(
		'label-is4',
		array(
			'type'        => 'button',
			'settings'    => array(),
			'label'       => __( 'Fourth Slide Active?', 'kindrex' ),
			'priority'    => 10,
			'section'     => 'kindrex-slider-section',
			'input_attrs' => array(
				'value'   => __( 'Get pro for this feature!', 'kindrex' ),
				'class'   => 'button-secondary',
				'onclick' => "window.open('https://www.designwicked.com/store/premium-kindrex', '_blank')",
			),
		)
	);

}

add_action( 'customize_register', 'kindrex_slider' );
