PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.9.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.9.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 2.10.2 All 137 releases
bit-form / includes / Frontend / Form / View / Theme / Fields / TextField.php

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

89 lines 2.9 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 use BitCode\BitForm\Frontend\Form\View\Theme\Fields\FieldHelpers;
7
8 class TextField
9 {
10 public static function init($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = null)
11 {
12 $inputWrapper = new InputWrapper($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error, $value);
13 $input = self::field($field, $rowID, $form_atomic_Cls_map, $value);
14 return $inputWrapper->wrapper($input);
15 }
16
17 private static function field($field, $rowID, $form_atomic_Cls_map, $value)
18 {
19 $fieldHelpers = new FieldHelpers($field, $rowID, $form_atomic_Cls_map);
20
21 $prefixIcn = $fieldHelpers->icon('prefixIcn', 'pre-i');
22 $suffixIcn = $fieldHelpers->icon('suffixIcn', 'suf-i');
23 $sugg = '';
24 $req = $fieldHelpers->required();
25 $disabled = $fieldHelpers->disabled();
26 $readonly = $fieldHelpers->readonly();
27 $inputMode = '';
28 $name = $fieldHelpers->name();
29 $ac = $fieldHelpers->autocomplete();
30 $mx = '';
31 $mn = '';
32 $ph = $fieldHelpers->placeholder();
33 $value = $fieldHelpers->value();
34 $list = '';
35 $bfFrontendFormIds = FrontendHelpers::$bfFrontendFormIds;
36 $contentCount = count($bfFrontendFormIds);
37
38 if (property_exists($field, 'suggestions') && count($field->suggestions) > 0) {
39 $list = "list='{$rowID}-{$contentCount}-datalist'";
40 $sugg .= "<datalist id='{$rowID}-{$contentCount}-datalist'>";
41 foreach ($field->suggestions as $suggestion) {
42 $val = (isset($suggestion->val) && !empty($suggestion->val)) ? $suggestion->val : $suggestion->lbl;
43 $sugg .= "<option value='{$fieldHelpers->esc_attr($val)}'>{$fieldHelpers->esc_html($suggestion->lbl)}</option>";
44 }
45 $sugg .= '</datalist>';
46 }
47
48 if (property_exists($field, 'mn') && '' !== $field->mn) {
49 $mn = "min='{$fieldHelpers->esc_attr($field->mn)}'";
50 }
51
52 if (property_exists($field, 'mx') && '' !== $field->mx) {
53 $mx = "max='{$fieldHelpers->esc_attr($field->mx)}'";
54 }
55
56 if (property_exists($field, 'inputMode') && '' !== $field->inputMode) {
57 $inputMode = "inputMode='{$fieldHelpers->esc_attr($field->inputMode)}'";
58 }
59
60 return <<<TEXTFIELD
61 <div
62 {$fieldHelpers->getCustomAttributes('inp-fld-wrp')}
63 class="{$fieldHelpers->getAtomicCls('inp-fld-wrp')} {$fieldHelpers->getCustomClasses('inp-fld-wrp')}"
64 >
65 <input
66 {$fieldHelpers->getCustomAttributes('fld')}
67 id="{$rowID}-{$contentCount}"
68 {$list}
69 class="{$fieldHelpers->getAtomicCls('fld')} {$fieldHelpers->getCustomClasses('fld')}"
70 type="{$field->typ}"
71 {$req}
72 {$disabled}
73 {$readonly}
74 {$ph}
75 {$mn}
76 {$mx}
77 {$ac}
78 {$inputMode}
79 {$name}
80 {$value}
81 />
82 {$prefixIcn}
83 {$suffixIcn}
84 </div>
85 {$sugg}
86 TEXTFIELD;
87 }
88 }
89