aboutsummaryrefslogtreecommitdiff
path: root/templates/forms/checkbox_collection_input.php
diff options
context:
space:
mode:
Diffstat (limited to 'templates/forms/checkbox_collection_input.php')
-rw-r--r--templates/forms/checkbox_collection_input.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/templates/forms/checkbox_collection_input.php b/templates/forms/checkbox_collection_input.php
new file mode 100644
index 0000000..9e6dec3
--- /dev/null
+++ b/templates/forms/checkbox_collection_input.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * @var bool $collapsible
+ * @var string $title
+ * @var array $options
+ * @var bool $required
+ * @var string $name
+ * @var array $selected
+ * @var array $attributes
+ */
+?>
+<fieldset<?= $collapsable ? ' class="collapsable collapsed"' : '' ?>>
+ <legend><?= htmlReady($title) ?></legend>
+ <? foreach ($options as $id => $displayname): ?>
+ <label<?= $required ? ' class="studiprequired"' : '' ?>>
+ <input type="checkbox"
+ v-model="<?= htmlReady($name) ?>"
+ name="<?= htmlReady($name) ?>[]"
+ value="<?= $id ?>"
+ class="<?= htmlReady($name . '-selector') ?>"
+ id="<?= $id ?>"
+ <?= $required ? 'required aria-required="true"' : '' ?>
+ <?= in_array($id, $selected) ? 'selected' : '' ?>
+ <?= $attributes ?>>
+ <span class="textlabel">
+ <?= htmlReady($displayname) ?>
+ </span>
+ <? if ($required) : ?>
+ <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span>
+ <? endif ?>
+ </label>
+ <? endforeach ?>
+</fieldset>