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 / FileUploadField.php

FileUploadField.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/FileUploadField.php

148 lines 4.3 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 FileUploadField
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, $field_name, $form_atomic_Cls_map, $formID, $error, $value);
13 return $inputWrapper->wrapper($input);
14 }
15
16 private static function field($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = null)
17 {
18 $fh = new ClassicFieldHelpers($field, $rowID, $form_atomic_Cls_map);
19 $prefixIcn = $fh->icon('prefixIcn', 'pre-i');
20 $suffixIcn = $fh->icon('suffixIcn', 'suf-i');
21 $name = $fh->name();
22 $req = $fh->required();
23 $ariaDescribedBy = $fh->ariaDescribedBy();
24 $ariaRequired = $fh->ariaRequired();
25 $readonlyCls = isset($field->readonly) ? 'readonly' : '';
26 $disabledCls = isset($field->disabled) ? 'disabled' : '';
27 $btnTxt = isset($field->btnTxt) ? $field->btnTxt : '';
28 $showSelectStatus = '';
29 $maxSizeSection = '';
30 $multiple = '';
31 $bfFrontendFormIds = FrontendHelpers::$bfFrontendFormIds;
32 $contentCount = count($bfFrontendFormIds);
33
34 if ($fh->property_exists_nested($field, 'config->multiple', true)) {
35 $multiple = 'multiple';
36 }
37
38 if ($fh->property_exists_nested($field, 'config->showSelectStatus', true)) {
39 $showSelectStatus = sprintf(
40 '<div
41 %1$s
42 class="%2$s %3$s"
43 >
44 No Choosen File
45 </div>',
46 $fh->getCustomAttributes('file-select-status'),
47 $fh->getAtomicCls('file-select-status'),
48 $fh->getCustomClasses('file-select-status')
49 );
50 }
51
52 $maxSizeSection = apply_filters('bitform_file_max_size_section', '', $field, $fh);
53
54 return sprintf(
55 '<div
56 %1$s
57 class="%2$s %3$s"
58 >
59 <div
60 %4$s
61 class="%5$s %6$s %7$s %8$s"
62 >
63 <div
64 %9$s
65 class="%10$s %11$s"
66 >
67 <div
68 %12$s
69 class="%13$s %14$s"
70 >
71 <button
72 %15$s
73 type="button"
74 class="%16$s %17$s"
75 >
76 %18$s
77 <span
78 %19$s
79 class="%20$s %21$s"
80 >
81 %22$s
82 </span>
83 %23$s
84 </button>
85 %24$s
86 %25$s
87 <input
88 %26$s
89 type="file"
90 class="%27$s %28$s"
91 id="%29$s-%30$s"
92 %31$s
93 %32$s
94 %33$s
95 %34$s
96 %35$s
97 aria-disabled="true"
98 tabindex="-1"
99 />
100 </div>
101 <div
102 %36$s
103 class="err-wrp %37$s"
104 ></div>
105 </div>
106 </div>
107 </div>',
108 $fh->getCustomAttributes('file-up-container'),
109 $fh->getAtomicCls('file-up-container'),
110 $fh->getCustomClasses('file-up-container'),
111 $fh->getCustomAttributes('file-up-wrpr'),
112 $fh->getAtomicCls('file-up-wrpr'),
113 $fh->getCustomClasses('file-up-wrpr'),
114 $readonlyCls,
115 $disabledCls,
116 $fh->getCustomAttributes('file-input-wrpr'),
117 $fh->getAtomicCls('file-input-wrpr'),
118 $fh->getCustomClasses('file-input-wrpr'),
119 $fh->getCustomAttributes('btn-wrpr'),
120 $fh->getAtomicCls('btn-wrpr'),
121 $fh->getCustomClasses('btn-wrpr'),
122 $fh->getCustomAttributes('inp-btn'),
123 $fh->getAtomicCls('inp-btn'),
124 $fh->getCustomClasses('inp-btn'),
125 $prefixIcn,
126 $fh->getCustomAttributes('btn-txt'),
127 $fh->getAtomicCls('btn-txt'),
128 $fh->getCustomClasses('btn-txt'),
129 $fh->kses_post($btnTxt),
130 $suffixIcn,
131 $showSelectStatus,
132 $maxSizeSection,
133 $fh->getCustomAttributes('file-upload-input'),
134 $fh->getAtomicCls('file-upload-input'),
135 $fh->getCustomClasses('file-upload-input'),
136 $rowID,
137 $contentCount,
138 $name,
139 $req,
140 $fh->disabled(),
141 $fh->readonly(),
142 $multiple,
143 $fh->getCustomAttributes('err-wrp'),
144 $fh->getCustomClasses('err-wrp')
145 );
146 }
147 }
148