PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.15.3
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.15.3
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
← All changes | includes/Frontend/Form/View/Theme/Fields/CheckBoxField.php +68 -89 3.3.12.15.3 View file →
@@ -22,9 +22,9 @@
22 22 $checkBoxOptions = '';
23 23 $bfFrontendFormIds = FrontendHelpers::$bfFrontendFormIds;
24 24 $contentCount = count($bfFrontendFormIds);
25 25
26 - if (is_object($field) && property_exists($field, 'opt') && is_countable($field->opt) && count($field->opt) > 0) {
26 + if (property_exists($field, 'opt') && count($field->opt) > 0) {
27 27 if (isset($field->val) && false !== strpos($field->val, BITFORMS_BF_SEPARATOR)) {
28 28 $defaultValues = explode(BITFORMS_BF_SEPARATOR, $field->val);
29 29 } else {
30 30 $defaultValues = isset($field->val) ? explode(',', $field->val) : [];
@@ -46,142 +46,121 @@
46 46 $req = 'required';
47 47 }
48 48 if ($fieldHelpers->property_exists_nested($field, 'valid->disabled', true)
49 49 || $fieldHelpers->property_exists_nested($opt, 'disabled', true)) {
50 - $disabled = 'disabled';
50 + $disabled = "disabled='disabled'";
51 51 }
52 52
53 - if (isset($field->mx) && !empty($field->valid->disableOnMax) && !$check && ((int) $field->mx <= count($defaultValues))) {
54 - $disabled = 'disabled';
55 - }
56 -
57 - $checkBoxOptions .= '
53 + $checkBoxOptions .= <<<CHECKBOXOPTIONS
58 54 <div
59 - ' . $fieldHelpers->getCustomAttributes('cw') . '
60 - class="' . $fieldHelpers->getAtomicCls('cw') . ' ' . $fieldHelpers->getCustomClasses('cw') . '"
55 + {$fieldHelpers->getCustomAttributes('cw')}
56 + class="{$fieldHelpers->getAtomicCls('cw')} {$fieldHelpers->getCustomClasses('cw')}"
61 57 >
62 58 <input
63 - id="' . $rowID . '-' . $contentCount . '-chk-' . $key . '"
59 + id="{$rowID}-{$contentCount}-chk-{$key}"
64 60 type="checkbox"
65 - class="' . $fieldHelpers->getAtomicCls('ci') . ' ' . $fieldHelpers->getCustomClasses('ci') . '"
66 - ' . $disabled . '
67 - value="' . $value . '"
68 - ' . $check . '
69 - ' . $req . '
70 - ' . $name . '
61 + class="{$fieldHelpers->getAtomicCls('ci')} {$fieldHelpers->getCustomClasses('ci')}"
62 + {$disabled}
63 + value="{$value}"
64 + {$check}
65 + {$req}
66 + {$name}
71 67 />
72 68 <label
73 - ' . $fieldHelpers->getCustomAttributes('cl') . '
69 + {$fieldHelpers->getCustomAttributes('cl')}
74 70 data-cl
75 - for="' . $rowID . '-' . $contentCount . '-chk-' . $key . '"
76 - class="' . $fieldHelpers->getAtomicCls('cl') . ' ' . $fieldHelpers->getCustomClasses('cl') . '"
71 + for="{$rowID}-{$contentCount}-chk-{$key}"
72 + class="{$fieldHelpers->getAtomicCls('cl')} {$fieldHelpers->getCustomClasses('cl')}"
77 73 >
78 74 <span
79 - ' . $fieldHelpers->getCustomAttributes('bx') . '
75 + {$fieldHelpers->getCustomAttributes('bx')}
80 76 data-bx
81 - class="' . $fieldHelpers->getAtomicCls('bx') . ' ' . $fieldHelpers->getCustomClasses('bx') . '"
77 + class="{$fieldHelpers->getAtomicCls('bx')} {$fieldHelpers->getCustomClasses('bx')}"
82 78 >
83 - <svg width="12" height="10" viewBox="0 0 12 10" class="' . $fieldHelpers->getAtomicCls('svgwrp') . ' ' . $fieldHelpers->getCustomClasses('svgwrp') . '" aria-hidden="true">
84 - <use data-ck-icn href="' . $href . '" class="' . $fieldHelpers->getAtomicCls('ck-icn') . ' ' . $fieldHelpers->getCustomClasses('ck-icn') . '" />
79 + <svg width="12" height="10" viewBox="0 0 12 10" class="{$fieldHelpers->getAtomicCls('svgwrp')} {$fieldHelpers->getCustomClasses('svgwrp')}">
80 + <use data-ck-icn href="$href" class="{$fieldHelpers->getAtomicCls('ck-icn')} {$fieldHelpers->getCustomClasses('ck-icn')}" />
85 81 </svg>
86 82 </span>
87 83 <span
88 - ' . $fieldHelpers->getCustomAttributes('ct') . '
89 - class="' . $fieldHelpers->getAtomicCls('ct') . ' ' . $fieldHelpers->getCustomClasses('ct') . '"
84 + {$fieldHelpers->getCustomAttributes('ct')}
85 + class="{$fieldHelpers->getAtomicCls('ct')} {$fieldHelpers->getCustomClasses('ct')}"
90 86 >
91 - ' . $fieldHelpers->kses_post($fieldHelpers->renderHTMR($opt->lbl)) . '
87 + {$fieldHelpers->kses_post($fieldHelpers->renderHTMR($opt->lbl))}
92 88 </span>
93 89 </label>
94 - </div>';
90 + </div>
91 +CHECKBOXOPTIONS;
95 92 }
96 93 }
97 94
98 95 //Other Option
99 - $optCount = isset($field->opt) && is_countable($field->opt) ? count($field->opt) : 0;
96 + $optCount = property_exists($field, 'opt') ? count($field->opt) : 0;
97 + $inputPh = isset($field->otherInpPh) ? "placeholder='{$fieldHelpers->esc_attr($field->otherInpPh)}'" : "placeholder='Other...'";
100 98 $inpReq = isset($field->valid->otherOptReq) ? ($field->valid->otherOptReq ? 'required' : '') : '';
101 - $otherOptLbl = !empty($field->otherOptLbl) ? $field->otherOptLbl : __('Other...', 'bit-form');
102 - $inputPh = isset($field->otherInpPh) ? "placeholder='{$fieldHelpers->esc_attr($field->otherInpPh)}'" : "placeholder='{$otherOptLbl}'";
103 99 if (property_exists($field, 'addOtherOpt') && $field->addOtherOpt) {
104 - $checkBoxOptions .=
105 - '<div
106 - ' . $fieldHelpers->getCustomAttributes('cw') . '
107 - class="' . $fieldHelpers->getAtomicCls('cw') . ' ' . $fieldHelpers->getCustomClasses('cw') . '"
100 + $checkBoxOptions .= <<<CHECKBOXOPTIONS
101 + <div
102 + {$fieldHelpers->getCustomAttributes('cw')}
103 + class="{$fieldHelpers->getAtomicCls('cw')} {$fieldHelpers->getCustomClasses('cw')}"
108 104 >
109 105 <input
110 - id="' . $rowID . '-' . $contentCount . '-chk-' . $optCount . '"
111 - data-oopt="' . $rowID . '"
106 + id="{$rowID}-{$contentCount}-chk-{$optCount}"
107 + data-oopt="{$rowID}"
112 108 type="checkbox"
113 - class="' . $fieldHelpers->getAtomicCls('ci') . ' ' . $fieldHelpers->getCustomClasses('ci') . '"
114 - ' . $disabled . '
109 + class="{$fieldHelpers->getAtomicCls('ci')} {$fieldHelpers->getCustomClasses('ci')}"
110 + {$disabled}
115 111 value=""
116 - ' . $name . '
112 + {$name}
117 113 />
118 114 <label
119 - ' . $fieldHelpers->getCustomAttributes('cl') . '
115 + {$fieldHelpers->getCustomAttributes('cl')}
120 116 data-cl
121 - for="' . $rowID . '-' . $contentCount . '-chk-' . $optCount . '"
122 - class="' . $fieldHelpers->getAtomicCls('cl') . ' ' . $fieldHelpers->getCustomClasses('cl') . '"
117 + for="{$rowID}-{$contentCount}-chk-{$optCount}"
118 + class="{$fieldHelpers->getAtomicCls('cl')} {$fieldHelpers->getCustomClasses('cl')}"
123 119 >
124 120 <span
125 - ' . $fieldHelpers->getCustomAttributes('ck') . '
121 + {$fieldHelpers->getCustomAttributes('ck')}
126 122 data-bx
127 - class="' . $fieldHelpers->getAtomicCls('bx') . ' ' . $fieldHelpers->getAtomicCls('ck') . ' ' . $fieldHelpers->getCustomClasses('ck') . '"
123 + class="{$fieldHelpers->getAtomicCls('bx')} {$fieldHelpers->getAtomicCls('ck')} {$fieldHelpers->getCustomClasses('ck')}"
128 124 >
129 - <svg width="12" height="10" viewBox="0 0 12 10" class="' . $fieldHelpers->getAtomicCls('svgwrp') . ' ' . $fieldHelpers->getCustomClasses('svgwrp') . '" aria-hidden="true">
130 - <use data-ck-icn href="#' . $rowID . '-ck-svg" class="' . $fieldHelpers->getAtomicCls('ck-icn') . ' ' . $fieldHelpers->getCustomClasses('ck-icn') . '" />
125 + <svg width="12" height="10" viewBox="0 0 12 10" class="{$fieldHelpers->getAtomicCls('svgwrp')} {$fieldHelpers->getCustomClasses('svgwrp')}">
126 + <use data-ck-icn href="#$rowID-ck-svg" class="{$fieldHelpers->getAtomicCls('ck-icn')} {$fieldHelpers->getCustomClasses('ck-icn')}" />
131 127 </svg>
132 128 </span>
133 129 <span
134 - ' . $fieldHelpers->getCustomAttributes('ct') . '
135 - class="' . $fieldHelpers->getAtomicCls('ct') . ' ' . $fieldHelpers->getCustomClasses('ct') . '"
130 + {$fieldHelpers->getCustomAttributes('ct')}
131 + class="{$fieldHelpers->getAtomicCls('ct')} {$fieldHelpers->getCustomClasses('ct')}"
136 132 >
137 - ' . $otherOptLbl . '
133 + Other..
138 134 </span>
139 135 </label>
140 - <div data-oinp-wrp class="' . $fieldHelpers->getAtomicCls('other-inp-wrp') . '">
136 + <div data-oinp-wrp class="{$fieldHelpers->getAtomicCls('other-inp-wrp')}">
141 137 <input
142 - data-bf-other-inp="' . $rowID . '-chk-' . $optCount . '"
138 + data-bf-other-inp='{$rowID}-chk-{$optCount}'
143 139 type="text"
144 - class="' . $fieldHelpers->getAtomicCls('other-inp') . ' ' . $fieldHelpers->getCustomClasses('other-inp') . '"
145 - ' . $inpReq . '
146 - ' . $inputPh . '
140 + class="{$fieldHelpers->getAtomicCls('other-inp')} {$fieldHelpers->getCustomClasses('other-inp')}"
141 + {$inpReq}
142 + {$inputPh}
147 143 />
148 144 </div>
149 - </div>';
145 + </div>
146 +CHECKBOXOPTIONS;
150 147 }
151 148
152 - $labelId = $fieldHelpers->getLabelId();
153 - $ariaDescribedBy = $fieldHelpers->ariaDescribedBy();
154 - $ariaRequired = $fieldHelpers->ariaRequired();
155 -
156 - return sprintf(
157 - '<div
158 - %1$s
159 - class="%2$s %3$s"
160 - role="group"
161 - aria-labelledby="%4$s"
162 - %5$s
163 - %6$s
164 - >
165 - <svg class="%7$s" aria-hidden="true">
166 - <symbol id="%8$s-ck-svg" viewBox="0 0 12 10">
167 - <polyline
168 - class="%9$s"
169 - points="1.5 6 4.5 9 10.5 1"
170 - ></polyline>
171 - </symbol>
172 - </svg>
173 - %10$s
174 - </div>',
175 - $fieldHelpers->getCustomAttributes('cc'),
176 - $fieldHelpers->getAtomicCls('cc'),
177 - $fieldHelpers->getCustomClasses('cc'),
178 - $labelId,
179 - $ariaDescribedBy,
180 - $ariaRequired,
181 - $fieldHelpers->getAtomicCls('cks'),
182 - $rowID,
183 - $fieldHelpers->getAtomicCls('ck-svgline'),
184 - $checkBoxOptions
185 - );
149 + return <<<CHECKBOXFIELD
150 +<div
151 + {$fieldHelpers->getCustomAttributes('cc')}
152 + class="{$fieldHelpers->getAtomicCls('cc')} {$fieldHelpers->getCustomClasses('cc')}"
153 +>
154 + <svg class="{$fieldHelpers->getAtomicCls('cks')}">
155 + <symbol id="{$rowID}-ck-svg" viewBox="0 0 12 10">
156 + <polyline
157 + class="{$fieldHelpers->getAtomicCls('ck-svgline')}"
158 + points="1.5 6 4.5 9 10.5 1"
159 + ></polyline>
160 + </symbol>
161 + </svg>
162 + {$checkBoxOptions}
163 +</div>
164 +CHECKBOXFIELD;
186 165 }
187 166 }