PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.0.1
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.0.1
6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 3.6.66 All 195 releases
fluentform / app / Http / Controllers / FormIntegrationController.php

FormIntegrationController.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.0.1, at app/Http/Controllers/FormIntegrationController.php

94 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Http\Controllers;
4
5 use FluentForm\App\Services\Integrations\FormIntegrationService;
6
7 class FormIntegrationController extends Controller
8 {
9 public function index(FormIntegrationService $integrationService)
10 {
11 try {
12 $formId = (int) $this->request->get('form_id');
13 return $this->sendSuccess(
14 $integrationService->get($formId)
15 );
16 } catch (\Exception $e) {
17 return $this->sendError([
18 'message' => $e->getMessage(),
19 ], 422);
20 }
21 }
22
23 public function find(FormIntegrationService $integrationService)
24 {
25 try {
26 $integration = $integrationService->find($this->request->all());
27 return $this->sendSuccess($integration);
28 } catch (Exception $e) {
29 return $this->sendError([
30 'message' => $e->getMessage(),
31 ], 422);
32 }
33 }
34
35 public function update(FormIntegrationService $integrationService)
36 {
37 try {
38 $integration = $integrationService->update($this->request->all());
39 return $this->sendSuccess($integration);
40 } catch (Exception $e) {
41 return $this->sendError([
42 'message' => $e->getMessage()
43 ], 422);
44 }
45 }
46
47 public function delete(FormIntegrationService $integrationService)
48 {
49 try {
50 $id = $this->request->get('integration_id');
51 $integrationService->delete($id);
52 return $this->sendSuccess([
53 'message' => __('Successfully deleted the Integration.', 'fluentform'),
54 ], 200);
55 } catch (Exception $e) {
56 return $this->sendError([
57 'message' => $e->getMessage(),
58 ], 422);
59 }
60 }
61
62 public function integrationListComponent()
63 {
64 try {
65 $integrationName = $this->request->get('integration_name');
66 $formId = intval($this->request->get('form_id'));
67 $listId = $this->request->get('list_id');
68 $merge_fields = false;
69 $merge_fields = apply_filters_deprecated(
70 'fluentform_get_integration_merge_fields_' . $integrationName,
71 [
72 $merge_fields,
73 $listId,
74 $formId
75 ],
76 FLUENTFORM_FRAMEWORK_UPGRADE,
77 'fluentform/get_integration_merge_fields_' . $integrationName,
78 'Use fluentform/get_integration_merge_fields_' . $integrationName . ' instead of fluentform_get_integration_merge_fields_' . $integrationName
79 );
80
81 $merge_fields = apply_filters('fluentform/get_integration_merge_fields_' . $integrationName, $merge_fields, $listId, $formId);
82
83 return $this->sendSuccess([
84 'merge_fields' => $merge_fields,
85 ]);
86 } catch (Exception $e) {
87 return $this->sendError([
88 'message' => $e->getMessage(),
89 ], 422);
90 }
91 }
92
93 }
94