| @@ -2,9 +2,8 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace BitCode\BitForm\API\BitForm_Public; |
| 4 | 4 | |
| 5 | 5 | use BitCode\BitForm\Core\Database\ApiModel; |
| 6 | -use BitCode\BitForm\Core\Util\Utilities; | |
| 7 | 6 | |
| 8 | 7 | class BitForm_Public |
| 9 | 8 | { |
| 10 | 9 | public static function getForms() |
| @@ -18,17 +17,13 @@ | ||
| 18 | 17 | { |
| 19 | 18 | $db = new ApiModel(); |
| 20 | 19 | $formData = $db->getField($formId); |
| 21 | 20 | if (!empty($formData)) { |
| 22 | - $unset_types = ['paypal', 'razorpay', 'stripe', 'recaptcha', 'hcaptcha']; | |
| 23 | - $formRow = Utilities::firstRow($formData); | |
| 24 | - $formContent = Utilities::jsonObj($formRow->form_content ?? ''); | |
| 25 | - if (!$formContent || !isset($formContent->fields)) { | |
| 26 | - return (object) []; | |
| 27 | - } | |
| 21 | + $unset_types = ['paypal', 'razorpay', 'stripe', 'recaptcha']; | |
| 22 | + $formContent = json_decode($formData[0]->form_content); | |
| 28 | 23 | foreach ($formContent->fields as $key => $field) { |
| 29 | 24 | if (in_array($field->typ, $unset_types)) { |
| 30 | - unset($formContent->fields->{$key}); | |
| 25 | + unset($formContent->fields->{$key}, $fieldsKey[$key]); | |
| 31 | 26 | } |
| 32 | 27 | } |
| 33 | 28 | return $formContent->fields; |
| 34 | 29 | } |