Browse code

Update

Benjamin Roth authored on24/03/2023 16:12:06
Showing1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 <?php $this->extend('form_row'); ?>
2 2
 
3 3
 <?php $this->block('label'); ?>
4
-<?php if ($this->label): ?>
4
+<?php /* if ($this->label): ?>
5 5
     <label for="ctrl_<?= $this->id ?>"<?php if ($this->class): ?> class="<?= $this->class ?>"<?php endif; ?>>
6 6
         <?php if ($this->mandatory): ?>
7 7
             <span class="invisible"><?= $this->mandatoryField ?> </span><?= $this->label ?><span
... ...
@@ -10,7 +10,7 @@
10 10
             <?= $this->label ?>
11 11
         <?php endif; ?>
12 12
     </label>
13
-<?php endif; ?>
13
+<?php endif; */ ?>
14 14
 <?php $this->endblock(); ?>
15 15
 
16 16
 <?php $this->block('field'); ?>
... ...
@@ -27,6 +27,7 @@
27 27
 
28 28
     <select name="<?= $this->name ?>" id="ctrl_<?= $this->id ?>"
29 29
             class="<?= $this->class ?>"<?= $this->getAttributes() ?>>
30
+        <option value="" disabled selected><?= $this->label ?><?php if ($this->mandatory): ?>*<?php endif; ?></option>
30 31
         <?php foreach ($this->getOptions() as $option): ?>
31 32
             <?php if ('group_start' == $option['type']): ?>
32 33
                 <optgroup label="<?= $option['label'] ?>">
Browse code

Initial commit

Benjamin Roth authored on16/03/2023 20:22:35
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,45 @@
1
+<?php $this->extend('form_row'); ?>
2
+
3
+<?php $this->block('label'); ?>
4
+<?php if ($this->label): ?>
5
+    <label for="ctrl_<?= $this->id ?>"<?php if ($this->class): ?> class="<?= $this->class ?>"<?php endif; ?>>
6
+        <?php if ($this->mandatory): ?>
7
+            <span class="invisible"><?= $this->mandatoryField ?> </span><?= $this->label ?><span
8
+                    class="mandatory">*</span>
9
+        <?php else: ?>
10
+            <?= $this->label ?>
11
+        <?php endif; ?>
12
+    </label>
13
+<?php endif; ?>
14
+<?php $this->endblock(); ?>
15
+
16
+<?php $this->block('field'); ?>
17
+<?php if ($this->hasErrors()): ?>
18
+    <p class="error"><?= $this->getErrorAsString() ?></p>
19
+<?php endif; ?>
20
+
21
+
22
+<div class="select-wrapper">
23
+    <?php if ($this->multiple): ?>
24
+    <input type="hidden" name="<?= '[]' == substr($this->name, -2) ? substr($this->name, 0, -2) : $this->name ?>"
25
+           value="">
26
+<?php endif; ?>
27
+
28
+    <select name="<?= $this->name ?>" id="ctrl_<?= $this->id ?>"
29
+            class="<?= $this->class ?>"<?= $this->getAttributes() ?>>
30
+        <?php foreach ($this->getOptions() as $option): ?>
31
+            <?php if ('group_start' == $option['type']): ?>
32
+                <optgroup label="<?= $option['label'] ?>">
33
+            <?php endif; ?>
34
+
35
+            <?php if ('option' == $option['type']): ?>
36
+                <option value="<?= $option['value'] ?>"<?= $option['selected'] ?>><?= $option['label'] ?></option>
37
+            <?php endif; ?>
38
+
39
+            <?php if ('group_end' == $option['type']): ?>
40
+                </optgroup>
41
+            <?php endif; ?>
42
+        <?php endforeach; ?>
43
+    </select>
44
+</div>
45
+<?php $this->endblock(); ?>