aboutsummaryrefslogtreecommitdiff
path: root/templates/forms/radio_input.php
blob: df911b2eda932b0499e9fa0273d1659c3659336f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
 * @var string $id
 * @var string $name
 * @var string $value
 * @var string|null $orientation
 * @var bool $required
 * @var array $options
 * @var string $attributes
 */
?>
<div class="formpart">
    <section <?= $orientation == 'horizontal' ? 'class="hgroup"' : '' ?> id="<?= htmlReady($id) ?>">
    <span class="textlabel<?= $required ? ' studiprequired' : '' ?> ">
        <?= htmlReady($this->title) ?>
        <? if ($required) : ?>
            <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span>
        <? endif ?>
    </span>

    <? $count = 0; foreach ($options as $key => $option) : ?>
        <label class="" <?= $attributes ?>>
                <input type="radio"
                       name="<?= htmlReady($name) ?>"
                       v-model="<?= htmlReady($name) ?>"
                       value="<?= htmlReady($key) ?>" <?= $key == $value ? 'checked' : '' ?>
                       <?= $required && $count === 0 ? ' required' : ''?>>
                    <?= htmlReady($option) ?>
        </label>
    <? $count++; endforeach ?>
</section>
</div>