<?php
declare(strict_types=1);
if ( ! defined( 'ABSPATH' ) ) { exit; }

class WTE_Icon_Select_Control extends \WP_Customize_Control {
	public $type = 'wte-icon-select';
	public function render_content(): void {
		$icons = [ 'star', 'check', 'briefcase', 'document', 'chat', 'gear', 'lock', 'chart', 'heart', 'lightbulb', 'shield', 'users' ];
		?>
		<label>
			<?php if ( $this->label ) : ?><span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span><?php endif; ?>
			<div class="wte-icon-select">
				<?php foreach ( $icons as $icon ) : ?>
					<label class="wte-icon-select__item<?php echo $this->value() === $icon ? ' is-active' : ''; ?>">
						<input type="radio" name="<?php echo esc_attr( $this->id ); ?>" value="<?php echo esc_attr( $icon ); ?>" <?php checked( $this->value(), $icon ); ?> <?php $this->link(); ?>>
						<span class="wte-icon-select__preview"><?php echo esc_html( $icon ); ?></span>
					</label>
				<?php endforeach; ?>
			</div>
		</label>
		<?php
	}
}
