<?php

// Customizer slider control
class Adventure_Trekking_Camp_Slider_Custom_Control extends WP_Customize_Control {
	public $type = 'slider_control';
	public function enqueue() {
		wp_enqueue_script( 'adventure-trekking-camp-custom-controls-js', trailingslashit( esc_url(get_template_directory_uri()) ) . 'assets/js/custom-controls.js', array( 'jquery', 'jquery-ui-core' ), '1.0', true );
		wp_enqueue_style( 'adventure-trekking-camp-custom-controls-css', trailingslashit( esc_url(get_template_directory_uri()) ) . 'assets/css/custom-controls.css', array(), '1.0', 'all' );
	}
	public function render_content() {
	?>
		<div class="slider-custom-control">
			<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span><input type="number" id="<?php echo esc_attr( $this->id ); ?>" name="<?php echo esc_attr( $this->id ); ?>" value="<?php echo esc_attr( $this->value() ); ?>" class="customize-control-slider-value"  <?php $this->link(); ?> />
			<div class="slider" slider-min-value="<?php echo esc_attr( $this->input_attrs['min'] ); ?>" slider-max-value="<?php echo esc_attr( $this->input_attrs['max'] ); ?>" slider-step-value="<?php echo esc_attr( $this->input_attrs['step'] ); ?>"></div><span class="slider-reset dashicons dashicons-image-rotate" slider-reset-value="<?php echo esc_attr( $this->input_attrs['reset'] ); ?>"></span>
		</div>
	<?php
	}
}
//image radio control
class Adventure_Trekking_Camp_Radio_Image_Control extends WP_Customize_Control {
        /**
         * The type of control being rendered
         */
        public $type = 'image_radio_button';
        /**
         * Enqueue our scripts and styles
         */
        public function enqueue() {
            wp_enqueue_style( 'adventure-trekking-camp-custom-controls-css', trailingslashit( esc_url(get_template_directory_uri()) ) . 'assets/css/custom-controls.css', array(), '1.0', 'all' );
        }
        /**
         * Render the control in the customizer
         */
        public function render_content() {
        ?>
            <div class="image_radio_button_control">
                <?php if( !empty( $this->label ) ) { ?>
                    <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
                <?php } ?>
                <?php if( !empty( $this->description ) ) { ?>
                    <span class="customize-control-description"><?php echo esc_html( $this->description ); ?></span>
                <?php } ?>

                <?php foreach ( $this->choices as $key => $value ) { ?>
                    <label class="radio-button-label">
                        <input type="radio" name="<?php echo esc_attr( $this->id ); ?>" value="<?php echo esc_attr( $key ); ?>" <?php $this->link(); ?> <?php checked( esc_attr( $key ), $this->value() ); ?>/>
                        <img src="<?php echo esc_attr( $value['image'] ); ?>" alt="<?php echo esc_attr( $value['name'] ); ?>" title="<?php echo esc_attr( $value['name'] ); ?>" />
                    </label>
                <?php   } ?>
            </div>
        <?php
        }
    }

// Heading

if( class_exists( 'WP_Customize_Control' ) ) {
    class Adventure_Trekking_Camp_Customizer_Customcontrol_Section_Heading extends WP_Customize_Control {
 
        // Declare the control type.
        public $type = 'section';

        // Render the control to be displayed in the Customizer.
        public function render_content() {
        ?>
            <div class="head-customize-section-description cus-head">
                <span class="title head-customize-control-title"><?php echo esc_html( $this->label ); ?></span>
                <?php if ( !empty( $this->description ) ) : ?>
                <span class="description-customize-control-description"><?php echo esc_html( $this->description ); ?></span>
            <?php endif; ?>
            </div>
        <?php
        }
    }
}
