| @@ -1,12 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace FluentForm\App\Modules\Form; |
| 4 | 4 | |
| 5 | -use FluentForm\App\Modules\Acl\Acl; | |
| 5 | +use FluentForm\App\Services\Form\Fields; | |
| 6 | 6 | use FluentForm\Framework\Foundation\Application; |
| 7 | -use FluentForm\App\Services\FormBuilder\EditorShortCode; | |
| 8 | -use FluentForm\Framework\Helpers\ArrayHelper; | |
| 9 | 7 | |
| 10 | 8 | class Inputs |
| 11 | 9 | { |
| 12 | 10 | /** |
| @@ -32,69 +30,7 @@ | ||
| 32 | 30 | public function index() |
| 33 | 31 | { |
| 34 | 32 | $formId = $this->request->get('formId'); |
| 35 | 33 | |
| 36 | - $form = wpFluent()->table('fluentform_forms')->find($formId); | |
| 37 | - | |
| 38 | - $fields = FormFieldsParser::getShortCodeInputs($form, [ | |
| 39 | - 'admin_label', 'attributes', 'options', | |
| 40 | - ]); | |
| 41 | - | |
| 42 | - $fields = array_filter($fields, function ($field) { | |
| 43 | - return in_array($field['element'], $this->supportedConditionalFields()); | |
| 44 | - }); | |
| 45 | - | |
| 46 | - wp_send_json($this->filterEditorFields($fields), 200); | |
| 47 | - } | |
| 48 | - | |
| 49 | - public function supportedConditionalFields() | |
| 50 | - { | |
| 51 | - $supportedConditionalFields = [ | |
| 52 | - 'select', | |
| 53 | - 'ratings', | |
| 54 | - 'net_promoter', | |
| 55 | - 'textarea', | |
| 56 | - 'shortcode', | |
| 57 | - 'input_url', | |
| 58 | - 'input_text', | |
| 59 | - 'input_date', | |
| 60 | - 'input_email', | |
| 61 | - 'input_radio', | |
| 62 | - 'input_number', | |
| 63 | - 'select_country', | |
| 64 | - 'input_checkbox', | |
| 65 | - 'input_password', | |
| 66 | - 'terms_and_condition', | |
| 67 | - 'gdpr_agreement', | |
| 68 | - 'input_hidden', | |
| 69 | - 'input_file', | |
| 70 | - 'input_image', | |
| 71 | - 'subscription_payment_component', | |
| 72 | - ]; | |
| 73 | - | |
| 74 | - $supportedConditionalFields = apply_filters_deprecated( | |
| 75 | - 'fluentform_supported_conditional_fields', | |
| 76 | - [ | |
| 77 | - $supportedConditionalFields | |
| 78 | - ], | |
| 79 | - FLUENTFORM_FRAMEWORK_UPGRADE, | |
| 80 | - 'fluentform/supported_conditional_fields', | |
| 81 | - 'Use fluentform/supported_conditional_fields instead of fluentform_supported_conditional_fields.' | |
| 82 | - ); | |
| 83 | - | |
| 84 | - return apply_filters('fluentform/supported_conditional_fields', $supportedConditionalFields); | |
| 85 | - } | |
| 86 | - | |
| 87 | - public function filterEditorFields($fields) | |
| 88 | - { | |
| 89 | - foreach ($fields as $index => $field) { | |
| 90 | - $element = ArrayHelper::get($field, 'element'); | |
| 91 | - if ('select_country' == $element) { | |
| 92 | - $fields[$index]['options'] = getFluentFormCountryList(); | |
| 93 | - } elseif ('gdpr-agreement' == $element || 'terms_and_condition' == $element) { | |
| 94 | - $fields[$index]['options'] = ['on' => 'Checked']; | |
| 95 | - } | |
| 96 | - } | |
| 97 | - | |
| 98 | - return $fields; | |
| 34 | + wp_send_json((new Fields())->get($formId), 200); | |
| 99 | 35 | } |
| 100 | 36 | } |