Browse code

First iteration of revamped formilicious for Contao 4.13+

Benjamin Roth authored on20/01/2023 09:49:23
Showing1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,37 +0,0 @@
1
-<?php $this->extend('form_row'); ?>
2
-
3
-<?php $this->block('label'); ?>
4
-<?php if ($this->hasErrors()): ?>
5
-  <span class="errortip" title="<?= htmlspecialchars($this->getErrorsAsString()); ?>" data-tooltip="position: top; offsetY: 10; theme: tooltipster-error; contentAsHTML: true;">?</span>
6
-<?php endif; ?>
7
-<?php if ($this->label): ?>
8
-  <label for="ctrl_<?= $this->id ?>"<?php if ($this->class): ?> class="<?= $this->class ?>"<?php endif; ?>>
9
-    <span class="invisible"><?= $this->mandatoryField ?> </span><?= $this->label ?><span class="mandatory">*</span>
10
-  </label>
11
-<?php endif; ?>
12
-<?php $this->endblock(); ?>
13
-
14
-<?php $this->block('field'); ?>
15
-<input type="text" name="<?= $this->name ?>" id="ctrl_<?= $this->id ?>" class="captcha mandatory<?php if ($this->class) echo ' ' . $this->class; ?>" value="" aria-describedby="captcha_text_<?= $this->id ?>"<?= $this->getAttributes() ?>>
16
-<span id="captcha_text_<?= $this->id ?>" class="captcha_text<?php if ($this->class) echo ' ' . $this->class; ?>"><?= $this->getQuestion() ?></span>
17
-<input type="hidden" name="<?= $this->name ?>_hash" value="<?= $this->getHash() ?>">
18
-
19
-<?php if (!$this->hasErrors()): ?>
20
-  <div style="display:none">
21
-    <label for="ctrl_<?= $this->id ?>_hp">Do not fill in this field</label>
22
-    <input type="text" name="<?= $this->name ?>_name" id="ctrl_<?= $this->id ?>_hp" value="">
23
-  </div>
24
-  <script>
25
-    var e = document.getElementById('ctrl_<?= $this->id ?>'),
26
-      p = e.parentNode, f = p.parentNode;
27
-
28
-    if ('fieldset' === f.nodeName.toLowerCase() && 1 === f.children.length) {
29
-      p = f;
30
-    }
31
-
32
-    p.style.display = 'none';
33
-    e.value = '<?= $this->getSum() ?>';
34
-  </script>
35
-<?php endif ?>
36
-
37
-<?php $this->endblock(); ?>
Browse code

Make it compatible with latest Contao versions 4.7 and 4.8

Benjamin Roth authored on07/10/2019 12:16:55
Showing1 changed files
... ...
@@ -14,6 +14,7 @@
14 14
 <?php $this->block('field'); ?>
15 15
 <input type="text" name="<?= $this->name ?>" id="ctrl_<?= $this->id ?>" class="captcha mandatory<?php if ($this->class) echo ' ' . $this->class; ?>" value="" aria-describedby="captcha_text_<?= $this->id ?>"<?= $this->getAttributes() ?>>
16 16
 <span id="captcha_text_<?= $this->id ?>" class="captcha_text<?php if ($this->class) echo ' ' . $this->class; ?>"><?= $this->getQuestion() ?></span>
17
+<input type="hidden" name="<?= $this->name ?>_hash" value="<?= $this->getHash() ?>">
17 18
 
18 19
 <?php if (!$this->hasErrors()): ?>
19 20
   <div style="display:none">
... ...
@@ -21,8 +22,15 @@
21 22
     <input type="text" name="<?= $this->name ?>_name" id="ctrl_<?= $this->id ?>_hp" value="">
22 23
   </div>
23 24
   <script>
24
-    document.getElementById('ctrl_<?= $this->id ?>').parentNode.style.display = 'none';
25
-    document.getElementById('ctrl_<?= $this->id ?>').value = '<?= $this->getSum() ?>';
25
+    var e = document.getElementById('ctrl_<?= $this->id ?>'),
26
+      p = e.parentNode, f = p.parentNode;
27
+
28
+    if ('fieldset' === f.nodeName.toLowerCase() && 1 === f.children.length) {
29
+      p = f;
30
+    }
31
+
32
+    p.style.display = 'none';
33
+    e.value = '<?= $this->getSum() ?>';
26 34
   </script>
27 35
 <?php endif ?>
28 36
 
Browse code

Captcha widget template adjustments for Contao ~4.4.x

Benjamin Roth authored on07/11/2018 12:37:55
Showing1 changed files
... ...
@@ -1,25 +1,29 @@
1 1
 <?php $this->extend('form_row'); ?>
2 2
 
3 3
 <?php $this->block('label'); ?>
4
-  <?php if ($this->hasErrors()): ?>
5
-    <span class="errortip" title="<?= htmlspecialchars($this->getErrorsAsString()); ?>" data-tooltip="position: top; offsetY: 10; theme: tooltipster-error; contentAsHTML: true;">?</span>
6
-  <?php endif; ?>
7
-
8
-  <?php if ($this->label): ?>
9
-    <label for="ctrl_<?= $this->id; ?>"<?php if ($this->class): ?> class="<?php echo $this->class; ?>"<?php endif; ?>>
10
-      <?php if ($this->mandatory): ?>
11
-        <span class="invisible"><?= $this->mandatoryField; ?></span> <?php echo $this->getQuestion(); ?><span class="mandatory">*</span>
12
-      <?php else: ?>
13
-        <?= $this->getQuestion(); ?>
14
-      <?php endif; ?>
15
-    </label>
16
-  <?php endif; ?>
4
+<?php if ($this->hasErrors()): ?>
5
+  <span class="errortip" title="<?= htmlspecialchars($this->getErrorsAsString()); ?>" data-tooltip="position: top; offsetY: 10; theme: tooltipster-error; contentAsHTML: true;">?</span>
6
+<?php endif; ?>
7
+<?php if ($this->label): ?>
8
+  <label for="ctrl_<?= $this->id ?>"<?php if ($this->class): ?> class="<?= $this->class ?>"<?php endif; ?>>
9
+    <span class="invisible"><?= $this->mandatoryField ?> </span><?= $this->label ?><span class="mandatory">*</span>
10
+  </label>
11
+<?php endif; ?>
17 12
 <?php $this->endblock(); ?>
18 13
 
19 14
 <?php $this->block('field'); ?>
20
-  <input type="text" name="<?= $this->name; ?>" id="ctrl_<?php echo $this->id; ?>" class="captcha mandatory<?php if ($this->class) echo ' ' . $this->class; ?>" value=""<?php echo $this->getAttributes(); ?>>
15
+<input type="text" name="<?= $this->name ?>" id="ctrl_<?= $this->id ?>" class="captcha mandatory<?php if ($this->class) echo ' ' . $this->class; ?>" value="" aria-describedby="captcha_text_<?= $this->id ?>"<?= $this->getAttributes() ?>>
16
+<span id="captcha_text_<?= $this->id ?>" class="captcha_text<?php if ($this->class) echo ' ' . $this->class; ?>"><?= $this->getQuestion() ?></span>
17
+
18
+<?php if (!$this->hasErrors()): ?>
19
+  <div style="display:none">
20
+    <label for="ctrl_<?= $this->id ?>_hp">Do not fill in this field</label>
21
+    <input type="text" name="<?= $this->name ?>_name" id="ctrl_<?= $this->id ?>_hp" value="">
22
+  </div>
23
+  <script>
24
+    document.getElementById('ctrl_<?= $this->id ?>').parentNode.style.display = 'none';
25
+    document.getElementById('ctrl_<?= $this->id ?>').value = '<?= $this->getSum() ?>';
26
+  </script>
27
+<?php endif ?>
21 28
 
22
-  <?php if ($this->addSubmit): ?>
23
-    <input type="submit" id="ctrl_<?= $this->id; ?>_submit" class="submit" value="<?php echo $this->slabel; ?>">
24
-  <?php endif; ?>
25 29
 <?php $this->endblock(); ?>
Browse code

Templates now use php short open tags

Benjamin Roth authored on17/08/2015 17:19:47
Showing1 changed files
... ...
@@ -2,24 +2,24 @@
2 2
 
3 3
 <?php $this->block('label'); ?>
4 4
   <?php if ($this->hasErrors()): ?>
5
-    <span class="errortip" title="<?php echo htmlspecialchars($this->getErrorsAsString()); ?>" data-tooltip="position: top; offsetY: 10; theme: tooltipster-error; contentAsHTML: true;">?</span>
5
+    <span class="errortip" title="<?= htmlspecialchars($this->getErrorsAsString()); ?>" data-tooltip="position: top; offsetY: 10; theme: tooltipster-error; contentAsHTML: true;">?</span>
6 6
   <?php endif; ?>
7 7
 
8 8
   <?php if ($this->label): ?>
9
-    <label for="ctrl_<?php echo $this->id; ?>"<?php if ($this->class): ?> class="<?php echo $this->class; ?>"<?php endif; ?>>
9
+    <label for="ctrl_<?= $this->id; ?>"<?php if ($this->class): ?> class="<?php echo $this->class; ?>"<?php endif; ?>>
10 10
       <?php if ($this->mandatory): ?>
11
-        <span class="invisible"><?php echo $this->mandatoryField; ?></span> <?php echo $this->getQuestion(); ?><span class="mandatory">*</span>
11
+        <span class="invisible"><?= $this->mandatoryField; ?></span> <?php echo $this->getQuestion(); ?><span class="mandatory">*</span>
12 12
       <?php else: ?>
13
-        <?php echo $this->getQuestion(); ?>
13
+        <?= $this->getQuestion(); ?>
14 14
       <?php endif; ?>
15 15
     </label>
16 16
   <?php endif; ?>
17 17
 <?php $this->endblock(); ?>
18 18
 
19 19
 <?php $this->block('field'); ?>
20
-  <input type="text" name="<?php echo $this->name; ?>" id="ctrl_<?php echo $this->id; ?>" class="captcha mandatory<?php if ($this->class) echo ' ' . $this->class; ?>" value=""<?php echo $this->getAttributes(); ?>>
20
+  <input type="text" name="<?= $this->name; ?>" id="ctrl_<?php echo $this->id; ?>" class="captcha mandatory<?php if ($this->class) echo ' ' . $this->class; ?>" value=""<?php echo $this->getAttributes(); ?>>
21 21
 
22 22
   <?php if ($this->addSubmit): ?>
23
-    <input type="submit" id="ctrl_<?php echo $this->id; ?>_submit" class="submit" value="<?php echo $this->slabel; ?>">
23
+    <input type="submit" id="ctrl_<?= $this->id; ?>_submit" class="submit" value="<?php echo $this->slabel; ?>">
24 24
   <?php endif; ?>
25 25
 <?php $this->endblock(); ?>
Browse code

Initial commit

Benjamin Roth authored on27/03/2015 10:45:40
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,25 @@
1
+<?php $this->extend('form_row'); ?>
2
+
3
+<?php $this->block('label'); ?>
4
+  <?php if ($this->hasErrors()): ?>
5
+    <span class="errortip" title="<?php echo htmlspecialchars($this->getErrorsAsString()); ?>" data-tooltip="position: top; offsetY: 10; theme: tooltipster-error; contentAsHTML: true;">?</span>
6
+  <?php endif; ?>
7
+
8
+  <?php if ($this->label): ?>
9
+    <label for="ctrl_<?php echo $this->id; ?>"<?php if ($this->class): ?> class="<?php echo $this->class; ?>"<?php endif; ?>>
10
+      <?php if ($this->mandatory): ?>
11
+        <span class="invisible"><?php echo $this->mandatoryField; ?></span> <?php echo $this->getQuestion(); ?><span class="mandatory">*</span>
12
+      <?php else: ?>
13
+        <?php echo $this->getQuestion(); ?>
14
+      <?php endif; ?>
15
+    </label>
16
+  <?php endif; ?>
17
+<?php $this->endblock(); ?>
18
+
19
+<?php $this->block('field'); ?>
20
+  <input type="text" name="<?php echo $this->name; ?>" id="ctrl_<?php echo $this->id; ?>" class="captcha mandatory<?php if ($this->class) echo ' ' . $this->class; ?>" value=""<?php echo $this->getAttributes(); ?>>
21
+
22
+  <?php if ($this->addSubmit): ?>
23
+    <input type="submit" id="ctrl_<?php echo $this->id; ?>_submit" class="submit" value="<?php echo $this->slabel; ?>">
24
+  <?php endif; ?>
25
+<?php $this->endblock(); ?>