PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.15.3
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.15.3
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
← All changes | includes/Frontend/Form/View/InputWrapper.php +85 -171 3.1.12.15.3 View file →
@@ -29,31 +29,26 @@
29 29 {
30 30 $labelWrapper = !$noLabel ? $this->labelWrapper() : '';
31 31 $helperText = $this->helperText();
32 32 $error = !$noErrMsg ? $this->errorMessages() : '';
33 - $fieldTypeClass = empty($this->_fieldData->typ) ? 'bf-default-field' : 'bf-' . $this->_fieldData->typ . '-field';
33 + $inputWrapper = <<<INPUTWRAPPER
34 + <div
35 + {$this->_fieldHelpers->getCustomAttributes('fld-wrp')}
36 + class="{$this->_fieldHelpers->getAtomicCls('fld-wrp')} {$this->_fieldHelpers->getCustomClasses('fld-wrp')}"
37 + >
38 + {$labelWrapper}
39 + <div
40 + {$this->_fieldHelpers->getCustomAttributes('inp-wrp')}
41 + class="{$this->_fieldHelpers->getAtomicCls('inp-wrp')} {$this->_fieldHelpers->getCustomClasses('inp-wrp')}"
42 + >
43 + {$field}
44 + {$helperText}
45 + {$error}
46 + </div>
47 + </div>
48 +INPUTWRAPPER;
34 49
35 - return sprintf(
36 - '<div %1$s class="%2$s %3$s %4$s">
37 - %5$s
38 - <div %6$s class="%7$s %8$s">
39 - %9$s
40 - %10$s
41 - %11$s
42 - </div>
43 - </div>',
44 - $this->_fieldHelpers->getCustomAttributes('fld-wrp'),
45 - $fieldTypeClass,
46 - $this->_fieldHelpers->getAtomicCls('fld-wrp'),
47 - $this->_fieldHelpers->getCustomClasses('fld-wrp'),
48 - $labelWrapper,
49 - $this->_fieldHelpers->getCustomAttributes('inp-wrp'),
50 - $this->_fieldHelpers->getAtomicCls('inp-wrp'),
51 - $this->_fieldHelpers->getCustomClasses('inp-wrp'),
52 - $field,
53 - $helperText,
54 - $error
55 - );
50 + return $inputWrapper;
56 51 }
57 52
58 53 private function labelWrapper()
59 54 {
@@ -77,37 +72,36 @@
77 72 $_subtitleText = wp_kses_post($this->_fieldHelpers->renderHTMR($replaceToBackSlash));
78 73 }
79 74
80 75 // for pre required icon
81 - // aria-hidden="true" is used because the asterisk is purely decorative/visual.
82 - // Screen readers will announce the field as required via aria-required="true" on the input element.
83 - // This prevents redundant "asterisk" or "star" announcements.
84 76 if (
85 77 $this->_fieldHelpers->property_exists_nested($this->_fieldData, 'valid->req')
86 78 && $this->_fieldHelpers->property_exists_nested($this->_fieldData, 'valid->reqShow', true)
87 79 && $this->_fieldHelpers->property_exists_nested($this->_fieldData, 'valid->reqPos', 'before')
88 80 ) {
89 - $_reqPre = sprintf(
90 - '<span %1$s class="%2$s %3$s" aria-hidden="true">*</span>',
91 - $this->_fieldHelpers->getCustomAttributes('req-smbl'),
92 - $this->_fieldHelpers->getAtomicCls('req-smbl'),
93 - $this->_fieldHelpers->getCustomClasses('req-smbl')
94 - );
81 + $_reqPre = <<<REQPRE
82 + <span
83 + {$this->_fieldHelpers->getCustomAttributes('req-smbl')}
84 + class="{$this->_fieldHelpers->getAtomicCls('req-smbl')} {$this->_fieldHelpers->getCustomClasses('req-smbl')}"
85 + >
86 + *
87 + </span>
88 +REQPRE;
95 89 }
96 90 // for post required icon
97 - // Same accessibility reasoning as pre required icon - hide from screen readers
98 - // to avoid redundant announcements since aria-required is on the input.
99 91 if (
100 92 $this->_fieldHelpers->property_exists_nested($this->_fieldData, 'valid->req')
101 93 && $this->_fieldHelpers->property_exists_nested($this->_fieldData, 'valid->reqShow', true)
102 94 && $this->_fieldHelpers->property_exists_nested($this->_fieldData, 'valid->reqPos', 'before', 1)
103 95 ) {
104 - $_reqPost = sprintf(
105 - '<span %1$s class="%2$s %3$s" aria-hidden="true">*</span>',
106 - $this->_fieldHelpers->getCustomAttributes('req-smbl'),
107 - $this->_fieldHelpers->getAtomicCls('req-smbl'),
108 - $this->_fieldHelpers->getCustomClasses('req-smbl')
109 - );
96 + $_reqPost = <<<REQPOST
97 + <span
98 + {$this->_fieldHelpers->getCustomAttributes('req-smbl')}
99 + class="{$this->_fieldHelpers->getAtomicCls('req-smbl')} {$this->_fieldHelpers->getCustomClasses('req-smbl')}"
100 + >
101 + *
102 + </span>
103 +REQPOST;
110 104 }
111 105
112 106 // for Label
113 107 if (
@@ -116,56 +110,44 @@
116 110 // && $this->_fieldData->valid->hideLbl !== true
117 111 ) {
118 112 $bfFrontendFormIds = FrontendHelpers::$bfFrontendFormIds;
119 113 $contentCount = count($bfFrontendFormIds);
120 - $labelId = $this->_fieldHelpers->getLabelId();
121 - $_label = sprintf(
122 - '<label
123 - id="%1$s"
124 - %2$s
125 - class="%3$s %4$s"
126 - for="%5$s-%6$d">
127 - %7$s
128 - %8$s
129 - %9$s
130 - %10$s
131 - %11$s
132 - </label>',
133 - $labelId,
134 - $this->_fieldHelpers->getCustomAttributes('lbl'),
135 - $this->_fieldHelpers->getAtomicCls('lbl'),
136 - $this->_fieldHelpers->getCustomClasses('lbl'),
137 - $this->_fieldKey,
138 - $contentCount,
139 - $_reqPre,
140 - $_lblPreIcn,
141 - $_lbl,
142 - $_lblSufIcn,
143 - $_reqPost
144 - );
114 + $_label = <<<LABEL
115 + <label
116 + {$this->_fieldHelpers->getCustomAttributes('lbl')}
117 + class="{$this->_fieldHelpers->getAtomicCls('lbl')} {$this->_fieldHelpers->getCustomClasses('lbl')}"
118 + for="{$this->_fieldKey}-{$contentCount}">
119 + {$_reqPre}
120 + {$_lblPreIcn}
121 + {$_lbl}
122 + {$_lblSufIcn}
123 + {$_reqPost}
124 + </label>
125 +LABEL;
145 126 }
146 127
147 128 // for subtitle
148 129 if (property_exists($this->_fieldData, 'subtitle') && $this->_fieldData->subtitleHide) {
149 - $_subtitle = sprintf(
150 - '<div %1$s class="%2$s %3$s">%4$s%5$s%6$s</div>',
151 - $this->_fieldHelpers->getCustomAttributes('sub-titl'),
152 - $this->_fieldHelpers->getAtomicCls('sub-titl'),
153 - $this->_fieldHelpers->getCustomClasses('sub-titl'),
154 - $_subtitlePreIcn,
155 - $_subtitleText,
156 - $_subtitlePostIcn
157 - );
130 + $_subtitle = <<<SUBTITLE
131 + <div
132 + {$this->_fieldHelpers->getCustomAttributes('sub-titl')}
133 + class="{$this->_fieldHelpers->getAtomicCls('sub-titl')} {$this->_fieldHelpers->getCustomClasses('sub-titl')}"
134 + >
135 + {$_subtitlePreIcn}
136 + {$_subtitleText}
137 + {$_subtitlePostIcn}
138 + </div>
139 +SUBTITLE;
158 140 }
159 -
160 - return sprintf(
161 - '<div %1$s class="%2$s %3$s">%4$s%5$s</div>',
162 - $this->_fieldHelpers->getCustomAttributes('lbl-wrp'),
163 - $this->_fieldHelpers->getAtomicCls('lbl-wrp'),
164 - $this->_fieldHelpers->getCustomClasses('lbl-wrp'),
165 - $_label,
166 - $_subtitle
167 - );
141 + return <<<LABELWRAPPER
142 + <div
143 + {$this->_fieldHelpers->getCustomAttributes('lbl-wrp')}
144 + class="{$this->_fieldHelpers->getAtomicCls('lbl-wrp')} {$this->_fieldHelpers->getCustomClasses('lbl-wrp')}"
145 + >
146 + {$_label}
147 + {$_subtitle}
148 + </div>
149 +LABELWRAPPER;
168 150 }
169 151
170 152 private function helperText()
171 153 {
@@ -177,27 +159,18 @@
177 159 $_helperTxt = wp_kses_post($this->_fieldHelpers->renderHTMR($this->_fieldData->helperTxt));
178 160 }
179 161
180 162 if (property_exists($this->_fieldData, 'helperTxt') && $this->_fieldData->helperTxt) {
181 - $helperTextId = $this->_fieldHelpers->getHelperTextId();
182 - $_helperTxt = sprintf(
183 - '<div
184 - id="%1$s"
185 - %2$s
186 - class="%3$s %4$s"
187 - >
188 - %5$s
189 - %6$s
190 - %7$s
191 - </div>',
192 - $helperTextId,
193 - $this->_fieldHelpers->getCustomAttributes('hlp-txt'),
194 - $this->_fieldHelpers->getAtomicCls('hlp-txt'),
195 - $this->_fieldHelpers->getCustomClasses('hlp-txt'),
196 - $_helperTxtPreIcn,
197 - $_helperTxt,
198 - $_helperTxtSufIcn
199 - );
163 + $_helperTxt = <<<HELPERTEXT
164 + <div
165 + {$this->_fieldHelpers->getCustomAttributes('hlp-txt')}
166 + class="{$this->_fieldHelpers->getAtomicCls('hlp-txt')} {$this->_fieldHelpers->getCustomClasses('hlp-txt')}"
167 + >
168 + {$_helperTxtPreIcn}
169 + {$_helperTxt}
170 + {$_helperTxtSufIcn}
171 + </div>
172 +HELPERTEXT;
200 173 }
201 174
202 175 // for helper text
203 176 return $_helperTxt;
@@ -214,9 +187,8 @@
214 187 $_error = wp_kses_post($this->_error);
215 188 $_style = 'margin-top: 5px !important; height: 9px !important;';
216 189 }
217 190
218 - $errorId = $this->_fieldHelpers->getErrorId();
219 191 $errMsgStart = '';
220 192 $errMsgEnd = '';
221 193 $msgStyle = "style='display: none !important;'";
222 194 $errMsgAtomicCls = $this->_fieldHelpers->getAtomicCls('err-msg');
@@ -230,75 +202,17 @@
230 202 $errMsgCustomCls = '';
231 203 $errMsgCustomAttr = '';
232 204 }
233 205
234 - return sprintf(
235 - '<div class="%1$s" role="alert" aria-atomic="true" aria-live="assertive" style="%2$s">
236 - <div class="%3$s">
237 - %4$s
238 - %5$s
239 - <div
240 - id="%6$s"
241 - %7$s
242 - %8$s
243 - class="%9$s %10$s %11$s %12$s "
244 - %13$s
245 - >
246 - %14$s
247 - </div>
248 - %15$s
249 - %16$s
250 - </div>
251 - </div>',
252 - $this->_fieldHelpers->getAtomicCls('err-wrp'), // 1
253 - $_style, // 2
254 - $this->_fieldHelpers->getAtomicCls('err-inner'), // 3
255 - $errMsgStart, // 4
256 - $_errorPreIcn, // 5
257 - $errorId, // 6
258 - $this->_fieldHelpers->getCustomAttributes('err-txt'), // 7
259 - $errMsgCustomAttr, // 8
260 - $errMsgAtomicCls, // 9
261 - $errMsgCustomCls, // 10
262 - $this->_fieldHelpers->getAtomicCls('err-txt'), // 11
263 - $this->_fieldHelpers->getCustomClasses('err-txt'), // 12
264 - $msgStyle, // 13
265 - $_error, // 14
266 - $_errorSufIcn, // 15
267 - $errMsgEnd // 16
268 - );
269 - }
270 -
271 - /**
272 - * Get the field helpers instance for external access
273 - * @return FieldHelpers
274 - */
275 - public function getFieldHelpers()
276 - {
277 - return $this->_fieldHelpers;
278 - }
279 -
280 - public function parentFieldWrapper($childFieldsInput)
281 - {
282 - return '<div '
283 - . $this->_fieldHelpers->getCustomAttributes('parent-fld-wrp')
284 - . ' class="' . $this->_fieldHelpers->getAtomicCls('parent-fld-wrp') . ' ' . $this->_fieldHelpers->getCustomClasses('parent-fld-wrp') . '">'
285 - . $childFieldsInput
286 - . '</div>';
287 - }
288 -
289 - public function childFieldWrapper($fieldInput, $subFieldName = '', $colSpan = null, $childKey = '')
290 - {
291 - $dataAttr = $subFieldName ? ' data-bf-subfield="' . esc_attr($subFieldName) . '"' : '';
292 - $styleAttr = null !== $colSpan ? ' style="--bfv-addr-col:' . (int) $colSpan . '"' : '';
293 - // Per-child class so conditional actions (show/hide) can collapse the whole column.
294 - $childKeyCls = $childKey ? ' ' . esc_attr($childKey) . '-sub-fld-wrp' : '';
295 - return '<div'
296 - . $dataAttr
297 - . $styleAttr
298 - . ' '
299 - . $this->_fieldHelpers->getCustomAttributes('child-fld-wrp')
300 - . ' class="' . $this->_fieldHelpers->getAtomicCls('child-fld-wrp') . ' ' . $this->_fieldHelpers->getCustomClasses('child-fld-wrp') . $childKeyCls . '">'
301 - . $fieldInput
302 - . '</div>';
206 + return <<<ERRORMESSAGES
207 + <div class='{$this->_fieldHelpers->getAtomicCls('err-wrp')}' style="{$_style}">
208 + <div class='{$this->_fieldHelpers->getAtomicCls('err-inner')}'>
209 + {$errMsgStart}
210 + {$_errorPreIcn}
211 + <div {$this->_fieldHelpers->getCustomAttributes('err-txt')} {$errMsgCustomAttr} class="{$errMsgAtomicCls} {$errMsgCustomCls} {$this->_fieldHelpers->getAtomicCls('err-txt')} {$this->_fieldHelpers->getCustomClasses('err-txt')}" {$msgStyle}>{$_error}</div>
212 + {$_errorSufIcn}
213 + {$errMsgEnd}
214 + </div>
215 + </div>
216 +ERRORMESSAGES;
303 217 }
304 218 }