<?php
$id = uniqid();
$name = $this->context->name;
$label = isset($this->context->label) ? $this->context->label . ':' : '';
$optionValues = $this->context->optionValues;
$optionLabels = $this->context->optionLabels;
$activeOptionValue = $this->context->activeOptionValue;
$keys = array_keys($optionValues);
$inputClass = isset($this->context->inputClass) ? $this->context->inputClass : '';
?>
<div class="form-row">
<label for="<?= $id ?>">
<?= $label ?>
</label>
<div class="input-wrapper">
<?php foreach ($keys as $key): ?>
<label>
<input type="radio"
name="<?= $name ?>"
<?php if ($inputClass): ?>
class="<?= $inputClass ?>"
<?php endif ?>
<?php if (count($keys) == 1): ?>
id="<?= $id ?>"
<?php if ($optionValues[$key] == $activeOptionValue): ?>
checked="checked"
value="<?= $optionValues[$key] ?>"/>
<?= $optionLabels[$key] ?>
<?php endforeach ?>
</div>