| 1 |
<?php |
| 2 |
|
| 3 |
namespace BitCode\BitForm\API\BitForm_Public; |
| 4 |
|
| 5 |
use BitCode\BitForm\Core\Database\ApiModel; |
| 6 |
|
| 7 |
class BitForm_Public { |
| 8 |
public static function getForms() { |
| 9 |
$db = new ApiModel(); |
| 10 |
$forms = $db->getForm(); |
| 11 |
return $forms; |
| 12 |
} |
| 13 |
|
| 14 |
public static function getFields($formId) { |
| 15 |
$db = new ApiModel(); |
| 16 |
$formData = $db->getField($formId); |
| 17 |
if (!empty($formData)) { |
| 18 |
$unset_types = ['paypal', 'razorpay', 'stripe', 'recaptcha']; |
| 19 |
$formContent = json_decode($formData[0]->form_content); |
| 20 |
foreach ($formContent->fields as $key => $field) { |
| 21 |
if (in_array($field->typ, $unset_types)) { |
| 22 |
unset($formContent->fields->{$key}, $fieldsKey[$key]); |
| 23 |
} |
| 24 |
} |
| 25 |
return $formContent->fields; |
| 26 |
} |
| 27 |
return (object) []; |
| 28 |
} |
| 29 |
} |
| 30 |
|