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