| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\App\Modules\Form\Settings; |
| 4 |
|
| 5 |
use FluentForm\App; |
| 6 |
use FluentForm\App\Modules\Acl\Acl; |
| 7 |
use FluentForm\Framework\Foundation\Application; |
| 8 |
|
| 9 |
class ExtraSettings |
| 10 |
{ |
| 11 |
/** |
| 12 |
* @var \FluentForm\Framework\Request\Request $request |
| 13 |
*/ |
| 14 |
protected $request; |
| 15 |
|
| 16 |
/** |
| 17 |
* @var \WpFluent\QueryBuilder\QueryBuilderHandler |
| 18 |
*/ |
| 19 |
protected $form_model; |
| 20 |
|
| 21 |
/** |
| 22 |
* Construct the object |
| 23 |
* @throws \Exception |
| 24 |
* @return void |
| 25 |
*/ |
| 26 |
public function __construct(Application $application) |
| 27 |
{ |
| 28 |
Acl::verify('fluentform_settings_manager'); |
| 29 |
|
| 30 |
$this->request = $application->request; |
| 31 |
$this->form_model = wpFluent()->table('fluentform_forms'); |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Get extra settig navigations |
| 36 |
* @return void |
| 37 |
*/ |
| 38 |
public function getExtraSettingNavs() |
| 39 |
{ |
| 40 |
$formId = $this->request->get('form_id'); |
| 41 |
$extraSettings = array( |
| 42 |
array( |
| 43 |
'name' => 'web_hooks', |
| 44 |
'label' => __('Web Hooks', 'fluentform'), |
| 45 |
'action' => 'fluentform_get_settings_page', |
| 46 |
'addon' => 'Fluent Web Hooks' |
| 47 |
), |
| 48 |
array( |
| 49 |
'name' => 'trello', |
| 50 |
'label' => __('Trello', 'fluentform'), |
| 51 |
'action' => 'fluentform_get_settings_page', |
| 52 |
'addon' => 'Trello' |
| 53 |
) |
| 54 |
); |
| 55 |
wp_send_json_success( |
| 56 |
array( |
| 57 |
'setting_navs' => $extraSettings |
| 58 |
), 200); |
| 59 |
exit(); |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Get extra settigs component |
| 64 |
* @return void |
| 65 |
*/ |
| 66 |
public function getExtraSettingsComponent() |
| 67 |
{ |
| 68 |
$formId = $this->request->get('form_id'); |
| 69 |
$module = $this->request->get('module'); |
| 70 |
|
| 71 |
$component = array( |
| 72 |
'name' => 'fluentform_settings_'.$module, |
| 73 |
'props' => ['form_id'], |
| 74 |
'template' => "<p>Setting Not Found</p>" |
| 75 |
); |
| 76 |
|
| 77 |
$component = apply_filters('fluentform_settings_module_'.$module, $component, $formId); |
| 78 |
|
| 79 |
wp_send_json_success(array( |
| 80 |
'component' => $component, |
| 81 |
'name' => 'fluentform_settings_'.$module, |
| 82 |
'js_url' => site_url().'/test.js' |
| 83 |
)); |
| 84 |
exit(); |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Get trello settigs |
| 89 |
* @return void |
| 90 |
*/ |
| 91 |
public function getTrelloSettingsComponent($component, $formId) |
| 92 |
{ |
| 93 |
return $component; |
| 94 |
} |
| 95 |
} |
| 96 |
|