This repository has been archived on 2025-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
szurubooru/src/Views/input/input-radioboxes.phtml

38 lines
991 B
PHTML
Raw Normal View History

2014-05-20 17:03:47 +02:00
<?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);
2014-05-20 19:46:05 +02:00
$inputClass = isset($this->context->inputClass) ? $this->context->inputClass : '';
2014-05-20 17:03:47 +02:00
?>
<div class="form-row">
<label for="<?= $id ?>">
<?= $label ?>
</label>
<div class="input-wrapper">
<?php foreach ($keys as $key): ?>
<label>
<input type="radio"
name="<?= $name ?>"
2014-05-20 19:46:05 +02:00
<?php if ($inputClass): ?>
class="<?= $inputClass ?>"
<?php endif ?>
2014-05-20 17:03:47 +02:00
<?php if (count($keys) == 1): ?>
id="<?= $id ?>"
<?php endif ?>
<?php if ($optionValues[$key] == $activeOptionValue): ?>
checked="checked"
<?php endif ?>
value="<?= $optionValues[$key] ?>"/>
<?= $optionLabels[$key] ?>
</label>
<?php endforeach ?>
</div>
</div>