PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / V3.3.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder vV3.3.2
V3.3.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 All 139 releases
← All changes | includes/Frontend/Form/View/Conversational/Fields/RadioBoxField.php +86 -73 2.10.0 → V3.3.2 View file →
@@ -17,13 +17,16 @@
17 17 {
18 18 $fieldHelpers = new ConversationalFieldHelpers($formID, $field, $rowID, $form_atomic_Cls_map);
19 19 $req = $fieldHelpers->required();
20 20 $name = $fieldHelpers->name();
21 + $ariaDescribedBy = $fieldHelpers->ariaDescribedBy();
22 + $ariaRequired = $fieldHelpers->ariaRequired();
23 + $labelId = $fieldHelpers->getLabelId();
21 24 $value = '';
22 25 $radioBoxOptions = '';
23 26 $bfFrontendFormIds = FrontendHelpers::$bfFrontendFormIds;
24 27 $contentCount = count($bfFrontendFormIds);
25 - if (property_exists($field, 'opt') && count($field->opt) > 0) {
28 + if (is_object($field) && property_exists($field, 'opt') && is_countable($field->opt) && count($field->opt) > 0) {
26 29 $defaultValue = isset($field->val) ? $field->val : '';
27 30 foreach ($field->opt as $key => $opt) {
28 31 $value = isset($opt->val) ? $opt->val : $opt->lbl;
29 32 $check = '';
@@ -45,110 +48,120 @@
45 48 || $fieldHelpers->property_exists_nested($opt, 'disabled', true)) {
46 49 $disabled = "disabled='disabled'";
47 50 }
48 51
49 - $radioBoxOptions .= <<<RADIOBOXOPTIONS
50 - <div
51 - {$fieldHelpers->getCustomAttributes('cw')}
52 - class="{$fieldHelpers->getConversationalCls('cw')} {$fieldHelpers->getCustomClasses('cw')}"
52 + $radioBoxOptions .= '<div
53 + ' . $fieldHelpers->getCustomAttributes('cw') . '
54 + class="' . $fieldHelpers->getConversationalCls('cw') . ' ' . $fieldHelpers->getCustomClasses('cw') . '"
53 55 >
54 56 <input
55 - {$fieldHelpers->getCustomAttributes('ci')}
56 - id="{$rowID}-{$contentCount}-chk-{$key}"
57 + ' . $fieldHelpers->getCustomAttributes('ci') . '
58 + id="' . $rowID . '-' . $contentCount . '-chk-' . $key . '"
57 59 type="radio"
58 - class="{$fieldHelpers->getConversationalCls('ci')} {$fieldHelpers->getCustomClasses('ci')}"
59 - value="{$fieldHelpers->esc_attr($value)}"
60 - {$check}
61 - {$name}
62 - {$req}
63 - {$disabled}
60 + role="radio"
61 + class="' . $fieldHelpers->getConversationalCls('ci') . ' ' . $fieldHelpers->getCustomClasses('ci') . '"
62 + value="' . $fieldHelpers->esc_attr($value) . '"
63 + ' . $check . '
64 + ' . $name . '
65 + ' . $req . '
66 + ' . $disabled . '
64 67 />
65 68 <label
66 - {$fieldHelpers->getCustomAttributes('cl')}
69 + ' . $fieldHelpers->getCustomAttributes('cl') . '
67 70 data-cl
68 - for="{$rowID}-{$contentCount}-chk-{$key}"
69 - class="{$fieldHelpers->getConversationalCls('cl')} {$fieldHelpers->getCustomClasses('cl')}"
71 + for="' . $rowID . '-' . $contentCount . '-chk-' . $key . '"
72 + class="' . $fieldHelpers->getConversationalCls('cl') . ' ' . $fieldHelpers->getCustomClasses('cl') . '"
70 73 >
71 74 <span
72 - {$fieldHelpers->getCustomAttributes('bx')}
75 + ' . $fieldHelpers->getCustomAttributes('bx') . '
73 76 data-bx
74 - class="{$fieldHelpers->getConversationalCls('bx')} {$fieldHelpers->getCustomClasses('bx')}"
77 + class="' . $fieldHelpers->getConversationalCls('bx') . ' ' . $fieldHelpers->getCustomClasses('bx') . '"
75 78 >
76 - <span class="{$fieldHelpers->getConversationalCls('opt-key-lbl')}">Key</span>
77 - <span class="{$fieldHelpers->getConversationalCls('opt-key')}">{$keyChar}</span>
79 + <span class="' . $fieldHelpers->getConversationalCls('opt-key-lbl') . '">Key</span>
80 + <span class="' . $fieldHelpers->getConversationalCls('opt-key') . '">' . $keyChar . '</span>
78 81 </span>
79 82 <span
80 - {$fieldHelpers->getCustomAttributes('ct')}
81 - class="{$fieldHelpers->getConversationalCls('ct')} {$fieldHelpers->getCustomClasses('ct')}"
83 + ' . $fieldHelpers->getCustomAttributes('ct') . '
84 + class="' . $fieldHelpers->getConversationalCls('ct') . ' ' . $fieldHelpers->getCustomClasses('ct') . '"
82 85 >
83 - {$fieldHelpers->kses_post($lbl)}
86 + ' . $fieldHelpers->kses_post($lbl) . '
84 87 </span>
85 88 </label>
86 89 </div>
87 -RADIOBOXOPTIONS;
90 +';
88 91 }
89 92 }
90 93
91 94 //Other Option
92 - $optCount = property_exists($field, 'opt') ? count($field->opt) : 0;
95 + $optCount = isset($field->opt) && is_countable($field->opt) ? count($field->opt) : 0;
96 + $otherOptLbl = !empty($field->otherOptLbl) ? $field->otherOptLbl : __('Other...', 'bit-form');
93 97 $inputPh = isset($field->otherInpPh) ? $field->otherInpPh : 'Other...';
94 98 $inpReq = isset($field->valid->otherOptReq) ? ($field->valid->otherOptReq ? 'required' : '') : '';
95 99 if (property_exists($field, 'addOtherOpt') && $field->addOtherOpt) {
96 100 $keyChar = chr(65 + count($field->opt));
97 - $radioBoxOptions .= <<<RADIOBOXOPTIONS
98 - <div
99 - {$fieldHelpers->getCustomAttributes('cw')}
100 - class="{$fieldHelpers->getConversationalCls('cw')} {$fieldHelpers->getCustomClasses('cw')}"
101 + $radioBoxOptions .= '
102 + <div
103 + ' . $fieldHelpers->getCustomAttributes('cw') . '
104 + class="' . $fieldHelpers->getConversationalCls('cw') . ' ' . $fieldHelpers->getCustomClasses('cw') . '"
101 105 >
102 - <input
103 - {$fieldHelpers->getCustomAttributes('ci')}
104 - id="{$rowID}-{$contentCount}-chk-{$optCount}"
105 - data-oopt="{$rowID}"
106 - type="radio"
107 - class="{$fieldHelpers->getConversationalCls('ci')} {$fieldHelpers->getCustomClasses('ci')}"
108 - value=""
109 - {$check}
110 - {$name}
111 - />
112 - <label
113 - {$fieldHelpers->getCustomAttributes('cl')}
114 - data-cl
115 - for="{$rowID}-{$contentCount}-chk-{$optCount}"
116 - class="{$fieldHelpers->getConversationalCls('cl')} {$fieldHelpers->getCustomClasses('cl')}"
117 - >
118 - <span
119 - {$fieldHelpers->getCustomAttributes('rdo')}
120 - data-bx
121 - class="{$fieldHelpers->getConversationalCls('bx')} {$fieldHelpers->getConversationalCls('rdo')} {$fieldHelpers->getCustomClasses('rdo')}"
122 - >
123 - <span class="{$fieldHelpers->getConversationalCls('opt-key')}">{$keyChar}</span>
124 - </span>
125 - <span
126 - {$fieldHelpers->getCustomAttributes('ct')}
127 - class="{$fieldHelpers->getConversationalCls('ct')} {$fieldHelpers->getCustomClasses('ct')}"
128 - >
129 - Other..
130 - </span>
131 - </label>
132 - <div data-oinp-wrp class="{$fieldHelpers->getConversationalCls('other-inp-wrp')}">
133 106 <input
134 - data-bf-other-inp="{$rowID}-chk-{$optCount}"
135 - type="text"
136 - class="{$fieldHelpers->getConversationalCls('other-inp')}"
137 - {$inpReq}
138 - placeholder="{$fieldHelpers->esc_attr($inputPh)}"
107 + ' . $fieldHelpers->getCustomAttributes('ci') . '
108 + id="' . $rowID . '-' . $contentCount . '-chk-' . $optCount . '"
109 + data-oopt="' . $rowID . '"
110 + type="radio"
111 + class="' . $fieldHelpers->getConversationalCls('ci') . ' ' . $fieldHelpers->getCustomClasses('ci') . '"
112 + value=""
113 + role="radio"
114 + ' . $name . '
115 + />
116 + <label
117 + ' . $fieldHelpers->getCustomAttributes('cl') . '
118 + data-cl
119 + for="' . $rowID . '-' . $contentCount . '-chk-' . $optCount . '"
120 + class="' . $fieldHelpers->getConversationalCls('cl') . ' ' . $fieldHelpers->getCustomClasses('cl') . '"
139 121 >
122 + <span
123 + ' . $fieldHelpers->getCustomAttributes('rdo') . '
124 + data-bx
125 + class="' . $fieldHelpers->getConversationalCls('bx') . ' ' . $fieldHelpers->getConversationalCls('rdo') . ' ' . $fieldHelpers->getCustomClasses('rdo') . '"
126 + >
127 + <span class="' . $fieldHelpers->getConversationalCls('opt-key') . '">' . $keyChar . '</span>
128 + </span>
129 + <span
130 + ' . $fieldHelpers->getCustomAttributes('ct') . '
131 + class="' . $fieldHelpers->getConversationalCls('ct') . ' ' . $fieldHelpers->getCustomClasses('ct') . '"
132 + >
133 + ' . $otherOptLbl . '
134 + </span>
135 + </label>
136 + <div data-oinp-wrp class="' . $fieldHelpers->getConversationalCls('other-inp-wrp') . '">
137 + <input
138 + data-bf-other-inp="' . $rowID . '-chk-' . $optCount . '"
139 + type="text"
140 + class="' . $fieldHelpers->getConversationalCls('other-inp') . '"
141 + ' . $inpReq . '
142 + placeholder="' . $fieldHelpers->esc_attr($inputPh) . '"
143 + />
144 + </div>
140 145 </div>
141 - </div>
142 -RADIOBOXOPTIONS;
146 +';
143 147 }
144 148
145 - return <<<RADIOBOX
149 + return sprintf(
150 + '
146 151 <div
147 - {$fieldHelpers->getCustomAttributes('cc')}
148 - class="{$fieldHelpers->getConversationalCls('cc')} {$fieldHelpers->getCustomClasses('cc')}"
152 + %1$s
153 + class="%2$s"
154 + role="radiogroup"
155 + aria-labelledby="%3$s"
156 + %4$s
149 157 >
150 - {$radioBoxOptions}
151 - </div>
152 -RADIOBOX;
158 + %5$s
159 + </div>',
160 + $fieldHelpers->getCustomAttributes('cc'),
161 + $fieldHelpers->getConversationalCls('cc') . ' ' . $fieldHelpers->getCustomClasses('cc'),
162 + $labelId,
163 + $ariaDescribedBy,
164 + $radioBoxOptions
165 + );
153 166 }
154 167 }