<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * @var $field_key
 * @var $value
 * @var $data
 * @var $tooltip
 * @var $description
 */

if ( empty( $value ) ) {
	$value = 'white';
}

$img_white   = inpost_intl_core()->get_plugin_images_url() . '/white.png';
$img_yellow  = inpost_intl_core()->get_plugin_images_url() . '/yellow.png';
$img_black   = inpost_intl_core()->get_plugin_images_url() . '/black.png';
$img_mondial = inpost_intl_core()->get_plugin_images_url() . '/mondial.png';
$img_custom  = '';
?>

<tr class="inpost-international-logo-settings">
	<th scope="row" class="titledesc">
		<label for="<?php echo esc_attr( $field_key ); ?>"><?php echo wp_kses_post( $data['title'] ); ?>
			<?php
			echo wp_kses_post( $tooltip ); // WPCS: XSS ok.
			?>
		</label>
	</th>
	<td class="forminp">
		<fieldset>
			<legend class="screen-reader-text">
				<span><?php echo wp_kses_post( $data['title'] ); ?></span>
			</legend>
			<!-- Radio with 4 options here -->
			<div class="inpost-intl-radio-options">
				<label>
					<input type="radio" name="<?php echo esc_attr( $field_key ); ?>_radio" value="white" <?php checked( $value, 'white' ); ?>>
					<img src="<?php echo esc_url( $img_white ); ?>" alt="White" width="60">
				</label>
				<label>
					<input type="radio" name="<?php echo esc_attr( $field_key ); ?>_radio" value="yellow" <?php checked( $value, 'yellow' ); ?>>
					<img src="<?php echo esc_url( $img_yellow ); ?>" alt="Yellow" width="60">
				</label>
				<label>
					<input type="radio" name="<?php echo esc_attr( $field_key ); ?>_radio" value="black" <?php checked( $value, 'black' ); ?>>
					<img src="<?php echo esc_url( $img_black ); ?>" alt="Black" width="60">
				</label>
				<label>
					<input type="radio" name="<?php echo esc_attr( $field_key ); ?>_radio" value="mondial" <?php checked( $value, 'mondial' ); ?>>
					<img src="<?php echo esc_url( $img_mondial ); ?>" alt="Mondial" width="60">
				</label>
				<label>
					<input type="radio" name="<?php echo esc_attr( $field_key ); ?>_radio" value="custom" <?php checked( $value, 'custom' ); ?>>
					<img id="inpost_intl_logo_custom_preview" src="" width="60">
					<button id='inpost-intl-logo-upload-btn'>
						<?php echo esc_html__( 'Upload', 'inpost-international' ); ?>
					</button>
				</label>
				<label>
					<input type="radio" name="<?php echo esc_attr( $field_key ); ?>_radio" value="none" <?php checked( $value, 'none' ); ?>>
					None
				</label>
			</div>
			<input type="hidden"
					name="<?php echo esc_attr( $field_key ); ?>"
					id="inpost_intl_logo_selected"
					value="<?php echo esc_attr( $value ); ?>"/>
			<?php
			echo wp_kses_post( $description ); // WPCS: XSS ok.
			?>
		</fieldset>
	</td>
</tr>
