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

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

108 lines 3.8 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 DecisionBoxField
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($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 ConversationalFieldHelpers($formID, $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 <<<DECISIONBOXFIELD
53 <div
54 {$fieldHelpers->getCustomAttributes('cc')}
55 class="{$fieldHelpers->getConversationalCls('cc')} {$fieldHelpers->getCustomClasses('cc')}"
56 >
57 <svg class="{$fieldHelpers->getConversationalCls('cks')}">
58 <symbol id="{$rowID}-ck-svg" viewBox="0 0 12 10">
59 <polyline
60 class="{$fieldHelpers->getConversationalCls('ck-svgline')}"
61 points="1.5 6 4.5 9 10.5 1"
62 />
63 </symbol>
64 </svg>
65
66 <div
67 {$fieldHelpers->getCustomAttributes('cw')}
68 class="{$fieldHelpers->getConversationalCls('cw')} {$fieldHelpers->getCustomClasses('cw')}"
69 >
70 <input
71 id="{$rowID}-{$contentCount}-decision"
72 type="checkbox"
73 class="{$fieldHelpers->getConversationalCls('ci')}"
74 {$disabled}
75 {$readonly}
76 {$req}
77 {$name}
78 {$checked}
79 {$value}
80 />
81 <label
82 {$fieldHelpers->getCustomAttributes('cl')}
83 data-cl
84 for="{$rowID}-{$contentCount}-decision"
85 class="{$fieldHelpers->getConversationalCls('cl')}"
86 >
87 <span
88 {$fieldHelpers->getCustomAttributes('bx')}
89 data-bx
90 class="{$fieldHelpers->getConversationalCls('bx')} {$fieldHelpers->getConversationalCls('bx')}"
91 >
92 <svg width="12" height="10" viewBox="0 0 12 10" class="{$fieldHelpers->getConversationalCls('svgwrp')}">
93 <use data-ck-icn href="#{$rowID}-ck-svg" class="{$fieldHelpers->getConversationalCls('ck-icn')}" />
94 </svg>
95 </span>
96 <span
97 {$fieldHelpers->getCustomAttributes('ct')}
98 class="{$fieldHelpers->getConversationalCls('ct')} {$fieldHelpers->getCustomClasses('ct')}"
99 >
100 {$fieldHelpers->kses_post($fieldHelpers->renderHTMR($lbl))}
101 </span>
102 </label>
103 </div>
104 </div>
105 DECISIONBOXFIELD;
106 }
107 }
108