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,47 @@
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
+    <span class="invisible"><?= $this->mandatoryField ?> </span><?= $this->label ?><span class="mandatory">*</span>
7
+  </label>
8
+<?php endif; ?>
9
+<?php $this->endblock(); ?>
10
+
11
+<?php $this->block('field'); ?>
12
+
13
+<span id="captcha_text_<?= $this->id ?>" class="d-block captcha_text<?php if ($this->class) : ?> <?= $this->class ?><?php endif; ?>"><?= $this->getQuestion() ?></span>
14
+<input type="text" name="<?= $this->name ?>" id="ctrl_<?= $this->id ?>" class="captcha mandatory form-control <?php if ($this->class) : ?> <?= $this->class ?><?php endif; ?>" value="" aria-describedby="captcha_text_<?= $this->id ?>" <?= $this->getAttributes() ?>>
15
+
16
+<input type="hidden" name="<?= $this->name ?>_hash" value="<?= $this->getHash() ?>">
17
+
18
+<?php if ($this->hasErrors()) : ?>
19
+  <p class="error"><?= $this->getErrorAsString() ?></p>
20
+<?php endif; ?>
21
+
22
+<?php if (!$this->hasErrors()) : ?>
23
+  <div style="display:none">
24
+    <label for="ctrl_<?= $this->id ?>_hp">Do not fill in this field</label>
25
+    <input type="text" class="form-control" name="<?= $this->name ?>_name" id="ctrl_<?= $this->id ?>_hp" value="">
26
+  </div>
27
+  <script>
28
+    (function() {
29
+      var e = document.getElementById('ctrl_<?= $this->id ?>'),
30
+        p = e.parentNode,
31
+        f = p.parentNode;
32
+
33
+      if (f.classList.contains('widget-captcha') || 'fieldset' === f.nodeName.toLowerCase() && 1 === f.children.length) {
34
+        p = f;
35
+      }
36
+
37
+      e.required = false;
38
+      p.style.display = 'none';
39
+
40
+      setTimeout(function() {
41
+        e.value = '<?= $this->getSum() ?>';
42
+      }, 5000);
43
+    })();
44
+  </script>
45
+<?php endif ?>
46
+
47
+<?php $this->endblock(); ?>
0 48
\ No newline at end of file