PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.0
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.0
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.0, at includes/Frontend/Form/View/Theme/Fields/DecisionBoxField.php

101 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 class DecisionBoxField {
6 public static function init($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = null) {
7 $inputWrapper = new InputWrapper($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error, $value);
8 $input = self::field($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error, $value);
9 return $inputWrapper->wrapper($input, true);
10 }
11
12 private static function field($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = null) {
13 $fieldHelpers = new FieldHelpers($field, $rowID, $form_atomic_Cls_map);
14
15 $suggestions = '';
16 $req = $fieldHelpers->required();
17 $disabled = '';
18 $readonly = '';
19 $name = $fieldHelpers->name();
20 $value = '';
21 if ($fieldHelpers->property_exists_nested($field, 'msg->checked')) {
22 $value = "value='{$field->msg->checked}'";
23 }
24 $checked = '';
25
26 if ($fieldHelpers->property_exists_nested($field, 'valid->disabled', true)) {
27 $disabled = 'disabled';
28 }
29
30 if ($fieldHelpers->property_exists_nested($field, 'valid->checked', true)) {
31 $checked = 'checked';
32 }
33
34 if ($fieldHelpers->property_exists_nested($field, 'valid->readonly', true)) {
35 $readonly = 'readonly';
36 }
37
38 $lbl = '';
39 if (isset($field->lbl) && !empty($field->lbl)) {
40 $lbl = $field->lbl;
41 } elseif ($fieldHelpers->property_exists_nested($field, 'info->lbl') && !empty($field->info->lbl)) {
42 $lbl = $field->info->lbl;
43 }
44
45 return <<<DECISIONBOXFIELD
46 <div
47 class="{$fieldHelpers->getAtomicCls('cc')} {$fieldHelpers->getCustomClasses('cc')}"
48 {$fieldHelpers->getCustomAttributes('cc')}
49 >
50 <svg class="{$fieldHelpers->getAtomicCls('cks')}">
51 <symbol id="${rowID}-ck-svg" viewBox="0 0 12 10">
52 <polyline
53 class="{$fieldHelpers->getAtomicCls('ck-svgline')}"
54 points="1.5 6 4.5 9 10.5 1"
55 />
56 </symbol>
57 </svg>
58
59 <div
60 class="{$fieldHelpers->getAtomicCls('cw')} {$fieldHelpers->getCustomClasses('cw')}"
61 {$fieldHelpers->getCustomAttributes('cw')}
62 >
63 <input
64 id="{$rowID}-decision"
65 type="checkbox"
66 class="{$fieldHelpers->getAtomicCls('ci')}"
67 {$disabled}
68 {$readonly}
69 {$req}
70 {$name}
71 {$checked}
72 {$value}
73 />
74 <label
75 data-cl
76 for="{$rowID}-decision"
77 class="{$fieldHelpers->getAtomicCls('cl')}"
78 {$fieldHelpers->getCustomAttributes('cl')}
79 >
80 <span
81 data-bx
82 class="{$fieldHelpers->getAtomicCls('bx')} {$fieldHelpers->getAtomicCls('bx')}"
83 {$fieldHelpers->getCustomAttributes('bx')}
84 >
85 <svg width="12" height="10" viewBox="0 0 12 10" class="{$fieldHelpers->getAtomicCls('svgwrp')}">
86 <use data-ck-icn href="#{$rowID}-ck-svg" class="{$fieldHelpers->getAtomicCls('ck-icn')}" />
87 </svg>
88 </span>
89 <span
90 class="{$fieldHelpers->getAtomicCls('ct')} {$fieldHelpers->getCustomClasses('ct')}"
91 {$fieldHelpers->getCustomAttributes('ct')}
92 >
93 {$fieldHelpers->renderHTMR($lbl)}
94 </span>
95 </label>
96 </div>
97 </div>
98 DECISIONBOXFIELD;
99 }
100 }
101