PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.21.13
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.21.13
3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 All 138 releases
bit-form / includes / Frontend / Form / View / Theme / Fields / SignatureField.php

SignatureField.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 2.21.13, at includes/Frontend/Form/View/Theme/Fields/SignatureField.php

148 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm\Frontend\Form\View\Theme\Fields;
4
5 use BitCode\BitForm\Core\Util\FrontendHelpers;
6
7 class SignatureField
8 {
9 public static function init($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = null)
10 {
11 $inputWrapper = new ClassicInputWrapper($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error, $value);
12 $input = self::field($field, $rowID, $form_atomic_Cls_map, $value);
13 return $inputWrapper->wrapper($input);
14 }
15
16 private static function field($field, $rowID, $form_atomic_Cls_map, $value)
17 {
18 $fieldHelpers = new ClassicFieldHelpers($field, $rowID, $form_atomic_Cls_map);
19
20 $name = $fieldHelpers->name();
21 $req = $fieldHelpers->required();
22
23 $clrBtnContent = '';
24 $undoBtnContent = '';
25 $redoBtnContent = '';
26
27 $bfFrontendFormIds = FrontendHelpers::$bfFrontendFormIds;
28 $contentCount = count($bfFrontendFormIds);
29
30 $clrBtnPreIcn = $fieldHelpers->icon('clrPreIcn', 'clr-btn-pre-i');
31 $clrBtnSufIcn = $fieldHelpers->icon('clrSufIcn', 'clr-btn-suf-i');
32 $undoBtnPreIcn = $fieldHelpers->icon('undoPreIcn', 'undo-btn-pre-i');
33 $undoBtnSufIcn = $fieldHelpers->icon('undoSufIcn', 'undo-btn-suf-i');
34 $redoBtnPreIcn = $fieldHelpers->icon('redoPreIcn', 'redo-btn-pre-i');
35 $redoBtnSufIcn = $fieldHelpers->icon('redoSufIcn', 'redo-btn-suf-i');
36
37 if (property_exists($field, 'clrBtnHide') && !$field->clrBtnHide) {
38 $clrBtnContent = sprintf(
39 '<button
40 aria-label="Signature pad clear button"
41 class="%1$s %2$s"
42 type="button"
43 %3$s
44 >
45 %4$s
46 %5$s
47 %6$s
48 </button>',
49 $fieldHelpers->getAtomicCls('clr-btn'),
50 $fieldHelpers->getCustomClasses('clr-btn'),
51 $fieldHelpers->getCustomAttributes('clr-btn'),
52 $clrBtnPreIcn,
53 $field->clrBtn,
54 $clrBtnSufIcn
55 );
56 }
57
58 if (property_exists($field, 'undoBtnHide') && !$field->undoBtnHide) {
59 $undoBtnContent = sprintf(
60 '<button
61 aria-label="Signature pad undo button"
62 class="%1$s %2$s"
63 type="button"
64 %3$s
65 >
66 %4$s
67 %5$s
68 %6$s
69 </button>',
70 $fieldHelpers->getAtomicCls('undo-btn'),
71 $fieldHelpers->getCustomClasses('undo-btn'),
72 $fieldHelpers->getCustomAttributes('undo-btn'),
73 $undoBtnPreIcn,
74 $field->undoBtn,
75 $undoBtnSufIcn
76 );
77 }
78
79 if (property_exists($field, 'redoBtnHide') && !$field->redoBtnHide) {
80 $redoBtnContent = sprintf(
81 '<button
82 aria-label="Signature pad redo button"
83 class="%1$s %2$s"
84 type="button"
85 %3$s
86 >
87 %4$s
88 %5$s
89 %6$s
90 </button>',
91 $fieldHelpers->getAtomicCls('redo-btn'),
92 $fieldHelpers->getCustomClasses('redo-btn'),
93 $fieldHelpers->getCustomAttributes('redo-btn'),
94 $redoBtnPreIcn,
95 $field->redoBtn,
96 $redoBtnSufIcn
97 );
98 }
99
100 return sprintf(
101 '<div
102 %1$s
103 class="%2$s %3$s"
104 >
105 <input
106 type="text"
107 %4$s
108 class="d-none %5$s-signature-fld bf-signature-hidden-input"
109 %6$s
110 value=""
111 />
112 <canvas
113 tabindex="0"
114 aria-label="Signature pad"
115 id="%5$s-%7$s"
116 class="%8$s %9$s"
117 %10$s
118 >
119 </canvas>
120
121 <div aria-label="Signature pad control buttons" class="%11$s %12$s">
122 %13$s
123 %14$s
124 %15$s
125 </div>
126
127 <iframe class="%16$s"></iframe>
128 </div>',
129 $fieldHelpers->getCustomAttributes('inp-fld-wrp'),
130 $fieldHelpers->getAtomicCls('inp-fld-wrp'),
131 $fieldHelpers->getCustomClasses('inp-fld-wrp'),
132 $name,
133 $rowID,
134 $req,
135 $contentCount,
136 $fieldHelpers->getAtomicCls('signature-pad'),
137 $fieldHelpers->getCustomClasses('signature-pad'),
138 $fieldHelpers->getCustomAttributes('signature-pad'),
139 $fieldHelpers->getAtomicCls('ctrl'),
140 $fieldHelpers->getCustomClasses('ctrl'),
141 $clrBtnContent,
142 $undoBtnContent,
143 $redoBtnContent,
144 $fieldHelpers->getAtomicCls('signature-iframe')
145 );
146 }
147 }
148