PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.21.13
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.21.13
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 / DecisionBoxField.php

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

140 lines 5.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\Theme\Fields;
4
5 use BitCode\BitForm\Core\Util\FrontendHelpers;
6
7 class DecisionBoxField
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, true);
14 }
15
16 private static function field($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = null)
17 {
18 $fieldHelpers = new ClassicFieldHelpers($field, $rowID, $form_atomic_Cls_map);
19
20 $suggestions = '';
21 $req = $fieldHelpers->required();
22 $disabled = '';
23 $readonly = '';
24 $name = $fieldHelpers->name();
25 $value = '';
26 $bfFrontendFormIds = FrontendHelpers::$bfFrontendFormIds;
27 $contentCount = count($bfFrontendFormIds);
28 if ($fieldHelpers->property_exists_nested($field, 'msg->checked')) {
29 $value = "value='{$field->msg->checked}'";
30 }
31 $checked = '';
32
33 if ($fieldHelpers->property_exists_nested($field, 'valid->disabled', true)) {
34 $disabled = 'disabled';
35 }
36
37 if ($fieldHelpers->property_exists_nested($field, 'valid->checked', true)) {
38 $checked = 'checked';
39 }
40
41 if ($fieldHelpers->property_exists_nested($field, 'valid->readonly', true)) {
42 $readonly = 'readonly';
43 }
44
45 $lbl = '';
46 if (isset($field->lbl) && !empty($field->lbl)) {
47 $lbl = $field->lbl;
48 } elseif ($fieldHelpers->property_exists_nested($field, 'info->lbl') && !empty($field->info->lbl)) {
49 $lbl = $field->info->lbl;
50 }
51
52 return sprintf(
53 '<div
54 %1$s
55 class="%2$s %3$s"
56 >
57 <svg class="%4$s">
58 <symbol id="%5$s-ck-svg" viewBox="0 0 12 10">
59 <polyline
60 class="%6$s"
61 points="1.5 6 4.5 9 10.5 1"
62 ></polyline>
63 </symbol>
64 </svg>
65
66 <div
67 %7$s
68 class="%8$s %9$s"
69 >
70 <input
71 id="%10$s-%11$s-decision"
72 type="checkbox"
73 class="%12$s"
74 %13$s
75 %14$s
76 %15$s
77 %16$s
78 %17$s
79 %18$s
80 />
81 <label
82 %19$s
83 data-cl
84 for="%20$s-%21$s-decision"
85 class="%22$s"
86 >
87 <span
88 %23$s
89 data-bx
90 class="%24$s %25$s"
91 >
92 <svg width="12" height="10" viewBox="0 0 12 10" class="%26$s">
93 <use data-ck-icn href="#%27$s-ck-svg" class="%28$s" />
94 </svg>
95 </span>
96 <span
97 %29$s
98 class="%30$s %31$s"
99 >
100 %32$s
101 </span>
102 </label>
103 </div>
104 </div>',
105 $fieldHelpers->getCustomAttributes('cc'), // 1
106 $fieldHelpers->getAtomicCls('cc'), // 2
107 $fieldHelpers->getCustomClasses('cc'), // 3
108 $fieldHelpers->getAtomicCls('cks'), // 4
109 $rowID, // 5
110 $fieldHelpers->getAtomicCls('ck-svgline'), // 6
111 $fieldHelpers->getCustomAttributes('cw'), // 7
112 $fieldHelpers->getAtomicCls('cw'), // 8
113 $fieldHelpers->getCustomClasses('cw'), // 9
114 $rowID, // 10
115 $contentCount, // 11
116 $fieldHelpers->getAtomicCls('ci'), // 12
117 $disabled, // 13
118 $readonly, // 14
119 $req, // 15
120 $name, // 16
121 $checked, // 17
122 $value, // 18
123 $fieldHelpers->getCustomAttributes('cl'), // 19
124 $rowID, // 20
125 $contentCount, // 21
126 $fieldHelpers->getAtomicCls('cl'), // 22
127 $fieldHelpers->getCustomAttributes('bx'), // 23
128 $fieldHelpers->getAtomicCls('bx'), // 24
129 $fieldHelpers->getAtomicCls('bx'), // 25
130 $fieldHelpers->getAtomicCls('svgwrp'), // 26
131 $rowID, // 27
132 $fieldHelpers->getAtomicCls('ck-icn'), // 28
133 $fieldHelpers->getCustomAttributes('ct'), // 29
134 $fieldHelpers->getAtomicCls('ct'), // 30
135 $fieldHelpers->getCustomClasses('ct'), // 31
136 $fieldHelpers->kses_post($fieldHelpers->renderHTMR($lbl)) // 32
137 );
138 }
139 }
140