aboutsummaryrefslogtreecommitdiff
path: root/templates/datafields/selectbox.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2025-08-26 08:53:09 +0200
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2025-08-26 08:54:29 +0200
commit00dd77ab6d5763d93999f00250cb5e6f4de12e9c (patch)
treef85ecafa7cf671f337961c3669932963528592a4 /templates/datafields/selectbox.php
parent5903190449f30edf66e8f0bb479ef19797e0ba27 (diff)
fix filters for select and boolean, fix filtering for deleted datafields, use default as well, some cleanupbiest-5848
Diffstat (limited to 'templates/datafields/selectbox.php')
-rw-r--r--templates/datafields/selectbox.php24
1 files changed, 20 insertions, 4 deletions
diff --git a/templates/datafields/selectbox.php b/templates/datafields/selectbox.php
index 0cc263e..177cc59 100644
--- a/templates/datafields/selectbox.php
+++ b/templates/datafields/selectbox.php
@@ -1,3 +1,14 @@
+<?php
+/**
+ * @var Datafield $model
+ * @var DatafieldEntry $entry
+ * @var string $value
+ * @var string $name
+ * @var bool $multiple
+ * @var bool $is_assoc
+ * @var array $type_param
+ */
+?>
<label>
<span class="datafield_title <?= $model->is_required ? 'required' : '' ?>">
<?= htmlReady($model->name) ?>
@@ -18,13 +29,18 @@
return ' selected';
};
?>
- <select name="<?= $name ?>[<?= $model->id ?>]<? if ($multiple) echo '[]'; ?>"
- id="<?= $name ?>_<?= $model->id ?>"
- <?= !$entry->isEditable() ? "disabled" : "" ?>
+ <select name="<?= htmlReady($name) ?>[<?= htmlReady($model->id) ?>]<? if ($multiple) echo '[]'; ?>"
+ id="<?= htmlReady($name) ?>_<?= htmlReady($model->id) ?>"
+ <? if (!$entry->isEditable()) echo 'disabled'; ?>
<? if ($multiple) echo 'multiple'; ?>
<? if ($model->is_required) echo 'required'; ?>>
+ <? if (!$model->is_required): ?>
+ <option value="">
+ (<?= _('keine Auswahl') ?>)
+ </option>
+ <? endif; ?>
<? foreach ($type_param as $pkey => $pval): ?>
- <option value="<?= $is_assoc ? (string)$pkey : $pval ?>"
+ <option value="<?= htmlReady($is_assoc ? (string) $pkey : $pval) ?>"
<?= $selected($is_assoc ? (string)$pkey : $pval) ?>>
<?= htmlReady($pval) ?>
</option>