PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.10.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.10.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 2.10.1, at includes/Frontend/Form/View/Conversational/Fields/TextField.php

88 lines 3.0 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 $sugg = '';
23 $req = $fieldHelpers->required();
24 $disabled = $fieldHelpers->disabled();
25 $readonly = $fieldHelpers->readonly();
26 $inputMode = '';
27 $name = $fieldHelpers->name();
28 $ac = $fieldHelpers->autocomplete();
29 $mx = '';
30 $mn = '';
31 $ph = $fieldHelpers->placeholder();
32 $value = $fieldHelpers->value();
33 $list = '';
34 $bfFrontendFormIds = FrontendHelpers::$bfFrontendFormIds;
35 $contentCount = count($bfFrontendFormIds);
36
37 if (property_exists($field, 'suggestions') && count($field->suggestions) > 0) {
38 $list = "list='{$rowID}-{$contentCount}-datalist'";
39 $sugg .= "<datalist id='{$rowID}-{$contentCount}-datalist'>";
40 foreach ($field->suggestions as $suggestion) {
41 $val = (isset($suggestion->val) && !empty($suggestion->val)) ? $suggestion->val : $suggestion->lbl;
42 $sugg .= "<option value='{$fieldHelpers->esc_attr($val)}'>{$fieldHelpers->esc_html($suggestion->lbl)}</option>";
43 }
44 $sugg .= '</datalist>';
45 }
46
47 if (property_exists($field, 'mn') && '' !== $field->mn) {
48 $mn = "min='{$fieldHelpers->esc_attr($field->mn)}'";
49 }
50
51 if (property_exists($field, 'mx') && '' !== $field->mx) {
52 $mx = "max='{$fieldHelpers->esc_attr($field->mx)}'";
53 }
54
55 if (property_exists($field, 'inputMode') && '' !== $field->inputMode) {
56 $inputMode = "inputMode='{$fieldHelpers->esc_attr($field->inputMode)}'";
57 }
58
59 return <<<TEXTFIELD
60 <div
61 {$fieldHelpers->getCustomAttributes('inp-fld-wrp')}
62 class="{$fieldHelpers->getConversationalCls('inp-fld-wrp')} {$fieldHelpers->getCustomClasses('inp-fld-wrp')}"
63 >
64 <input
65 {$fieldHelpers->getCustomAttributes('fld')}
66 id="{$rowID}-{$contentCount}"
67 {$list}
68 class="{$fieldHelpers->getConversationalCls('focus-elm')} {$fieldHelpers->getConversationalMultiCls('fld')} {$fieldHelpers->getCustomClasses('fld')}"
69 type="{$field->typ}"
70 {$req}
71 {$disabled}
72 {$readonly}
73 {$ph}
74 {$mn}
75 {$mx}
76 {$ac}
77 {$inputMode}
78 {$name}
79 {$value}
80 />
81 {$prefixIcn}
82 {$suffixIcn}
83 </div>
84 {$sugg}
85 TEXTFIELD;
86 }
87 }
88