PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.1.4
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.1.4
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 / TextField.php

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

120 lines 3.4 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 TextField
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, $formID);
13 return $inputWrapper->wrapper($input);
14 }
15
16 private static function field($field, $rowID, $form_atomic_Cls_map, $value, $formID = null)
17 {
18 $fieldHelpers = new ClassicFieldHelpers($field, $rowID, $form_atomic_Cls_map, $formID);
19
20 $prefixIcn = $fieldHelpers->icon('prefixIcn', 'pre-i');
21 $suffixIcn = $fieldHelpers->icon('suffixIcn', 'suf-i');
22 $req = $fieldHelpers->required();
23 $disabled = $fieldHelpers->disabled();
24 $readonly = $fieldHelpers->readonly();
25 $inputMode = apply_filters('bitform_field_inputmode_attr', '', $field);
26 $name = $fieldHelpers->name();
27 $ac = $fieldHelpers->autocomplete();
28 $mx = apply_filters('bitform_field_max_attr', '', $field);
29 $mn = apply_filters('bitform_field_min_attr', '', $field);
30 $minlength = $fieldHelpers->minlength();
31 $maxlength = $fieldHelpers->maxlength();
32 $maxword = $fieldHelpers->maxword();
33 $minword = $fieldHelpers->minword();
34 $ph = $fieldHelpers->placeholder();
35 $value = $fieldHelpers->value();
36 $ariaDescribedBy = $fieldHelpers->ariaDescribedBy();
37 $ariaRequired = $fieldHelpers->ariaRequired();
38 $list = '';
39 $bfFrontendFormIds = FrontendHelpers::$bfFrontendFormIds;
40 $contentCount = count($bfFrontendFormIds);
41 $sugg = apply_filters('bitform_field_suggestions_datalist', '', $field, $rowID, $contentCount);
42
43 $showPickerAttr = self::showPickerAttr($field);
44
45 if (property_exists($field, 'suggestions') && count($field->suggestions) > 0) {
46 $list = "list='{$rowID}-{$contentCount}-datalist'";
47 }
48
49 return sprintf(
50 '<div %1$s class="%2$s %3$s">
51 <input
52 %4$s
53 id="%5$s"
54 %6$s
55 class="%7$s %8$s"
56 type="%9$s"
57 %10$s
58 %11$s
59 %12$s
60 %13$s
61 %14$s
62 %15$s
63 %16$s
64 %17$s
65 %18$s
66 %19$s
67 %20$s
68 %21$s
69 %22$s
70 %23$s
71 %24$s
72 %25$s
73 %26$s
74 />
75 %27$s
76 %28$s
77 </div>
78 %29$s',
79 $fieldHelpers->getCustomAttributes('inp-fld-wrp'),
80 $fieldHelpers->getAtomicCls('inp-fld-wrp'),
81 $fieldHelpers->getCustomClasses('inp-fld-wrp'),
82 $fieldHelpers->getCustomAttributes('fld'),
83 "{$rowID}-{$contentCount}",
84 $list,
85 $fieldHelpers->getAtomicCls('fld'),
86 $fieldHelpers->getCustomClasses('fld'),
87 esc_attr($field->typ),
88 $req,
89 $ariaRequired,
90 $ariaDescribedBy,
91 $disabled,
92 $readonly,
93 $ph,
94 $mn,
95 $mx,
96 $minlength,
97 $maxlength,
98 $maxword,
99 $minword,
100 $ac,
101 $inputMode,
102 $name,
103 $value,
104 $showPickerAttr,
105 $prefixIcn,
106 $suffixIcn,
107 $sugg
108 );
109 }
110
111 private static function showPickerAttr($field)
112 {
113 $dateType = ['date', 'datetime-local', 'month', 'time', 'week'];
114 if (in_array($field->typ, $dateType, true)) {
115 return 'data-bf-show-picker="1"';
116 }
117 return '';
118 }
119 }
120