<?php
if ( ! class_exists( 'WP_Customize_Control' ) ) :
	return;	
endif;
	
class WPCTP_Image_Choices_Control extends WP_Customize_Control {
	public $type = 'image-choices';
	public function render_content() {
		if ( empty( $this->choices ) ) :
			return;
		endif;
		$name = '_customize-radio-' . $this->id;
		?>
		<label>
			<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
			<div class="image-choices-wrap <?php echo esc_attr($this->type); ?>">
				<?php foreach ( $this->choices as $value => $label ) : ?>
                    <?php $selected =  $this->value(); ?>
                    <label <?php echo ($value == $selected) ? 'class="selected"' : ''; ?>>
                        <em style="padding: 10px 3px;display: block;line-height: 1;"><?php echo $label['label']; ?></em>
                        <input type="radio" value="<?php echo esc_attr( $value ); ?>" name="<?php echo esc_attr( $name ); ?>" <?php $this->link(); checked( $this->value(), $value ); ?> style="display:none;" />
                        <?php if($label == 'none') : ?>
                        <img src="<?php echo WPCTP_IMAGES_URL . '/none.jpg'; ?>" alt="<?php echo $label['label']; ?>" />
                        <?php else : ?>
                        <img src="<?php echo esc_attr( $label['image_url'] ); ?>" alt="<?php  $label['label']; ?>" />
                        <?php endif; ?>
                    </label>
                <?php endforeach; ?>
			</div>
		</label>
		<?php
	}
}