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

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

86 lines 3.2 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\Conversational\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 ConversationalInputWrapper($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error, $value);
12 $input = self::field($formID, $field, $rowID, $form_atomic_Cls_map, $value);
13 return $inputWrapper->wrapper($input);
14 }
15
16 private static function field($formID, $field, $rowID, $form_atomic_Cls_map, $value)
17 {
18 $fieldHelpers = new ConversationalFieldHelpers($formID, $field, $rowID, $form_atomic_Cls_map);
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 if (property_exists($field, 'suggestions') && count($field->suggestions) > 0) {
44 $list = "list='{$rowID}-{$contentCount}-datalist'";
45 }
46
47 $inputWrapperCustomAttributes = $fieldHelpers->getCustomAttributes('inp-fld-wrp');
48 $inputWrapperClass = $fieldHelpers->getConversationalCls('inp-fld-wrp') . ' ' . $fieldHelpers->getCustomClasses('inp-fld-wrp');
49 $fieldCustomAttributes = $fieldHelpers->getCustomAttributes('fld');
50 $fieldClass = $fieldHelpers->getConversationalCls('focus-elm') . ' ' . $fieldHelpers->getConversationalMultiCls('fld') . ' ' . $fieldHelpers->getCustomClasses('fld');
51 $id = "{$rowID}-{$contentCount}";
52
53 return '<div
54 ' . $inputWrapperCustomAttributes . '
55 class="' . $inputWrapperClass . '"
56 >
57 <input
58 ' . $fieldCustomAttributes . '
59 id="' . $id . '"
60 ' . $list . '
61 class="' . $fieldClass . '"
62 type="' . $field->typ . '"
63 ' . $req . '
64 ' . $ariaRequired . '
65 ' . $ariaDescribedBy . '
66 ' . $disabled . '
67 ' . $readonly . '
68 ' . $ph . '
69 ' . $mn . '
70 ' . $mx . '
71 ' . $minlength . '
72 ' . $maxlength . '
73 ' . $maxword . '
74 ' . $minword . '
75 ' . $ac . '
76 ' . $inputMode . '
77 ' . $name . '
78 ' . $value . '
79 />
80 ' . $prefixIcn . '
81 ' . $suffixIcn . '
82 </div>
83 ' . $sugg;
84 }
85 }
86