← All changes
|
includes/Frontend/Form/View/Theme/Fields/RadioBoxField.php
+3
-3
-3.0.1
→
V3.3.2
View file →
| @@ -21,12 +21,12 @@ | ||
| 21 | 21 | $value = ''; |
| 22 | 22 | $radioBoxOptions = ''; |
| 23 | 23 | $bfFrontendFormIds = FrontendHelpers::$bfFrontendFormIds; |
| 24 | 24 | $contentCount = count($bfFrontendFormIds); |
| 25 | - if (property_exists($field, 'opt') && count($field->opt) > 0) { | |
| 25 | + if (is_object($field) && property_exists($field, 'opt') && is_countable($field->opt) && count($field->opt) > 0) { | |
| 26 | 26 | $defaultValue = isset($field->val) ? $field->val : ''; |
| 27 | 27 | foreach ($field->opt as $key => $opt) { |
| 28 | - $value = isset($opt->val) ? $opt->val : $opt->lbl; | |
| 28 | + $value = isset($opt->val) ? $opt->val : ($opt->lbl ?? ''); | |
| 29 | 29 | $check = ''; |
| 30 | 30 | $req = ''; |
| 31 | 31 | $lbl = $fieldHelpers->renderHTMR($opt->lbl); |
| 32 | 32 | $disabled = ''; |
| @@ -127,9 +127,9 @@ | ||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | //Other Option |
| 130 | 130 | $otherOptLbl = !empty($field->otherOptLbl) ? $field->otherOptLbl : __('Other...', 'bit-form'); |
| 131 | - $optCount = property_exists($field, 'opt') ? count($field->opt) : 0; | |
| 131 | + $optCount = isset($field->opt) && is_countable($field->opt) ? count($field->opt) : 0; | |
| 132 | 132 | $inputPh = isset($field->otherInpPh) ? $field->otherInpPh : $otherOptLbl; |
| 133 | 133 | $inpReq = isset($field->valid->otherOptReq) ? ($field->valid->otherOptReq ? 'required' : '') : ''; |
| 134 | 134 | if (property_exists($field, 'addOtherOpt') && $field->addOtherOpt) { |
| 135 | 135 | $check = $check ?? ''; |