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

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