PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 5.2.0
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v5.2.0
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 / FormSettingsController.php

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

141 lines 4.1 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 Exception;
6 use FluentForm\App\Services\Settings\Customizer;
7 use FluentForm\App\Services\Settings\SettingsService;
8 use FluentForm\Framework\Validator\ValidationException;
9 use FluentForm\App\Services\Submission\SubmissionService;
10
11 class FormSettingsController extends Controller
12 {
13 public function index(SettingsService $settingsService)
14 {
15 $result = $settingsService->get($this->request->all());
16
17 return $this->sendSuccess($result);
18 }
19
20 public function general(SettingsService $settingsService, $formId)
21 {
22 $result = $settingsService->general($formId);
23
24 return $this->sendSuccess($result);
25 }
26
27 public function saveGeneral(SettingsService $settingsService)
28 {
29 try {
30 $settingsService->saveGeneral($this->request->all());
31
32 return $this->sendSuccess([
33 'message' => __('Settings has been saved.', 'fluentform'),
34 ]);
35 } catch (ValidationException $exception) {
36 return $this->sendError($exception->errors(), 422);
37 }
38 }
39
40 public function store(SettingsService $settingsService)
41 {
42 try {
43 [$settingsId, $settings] = $settingsService->store($this->request->all());
44
45 return $this->sendSuccess([
46 'message' => __('Settings has been saved.', 'fluentform'),
47 'id' => $settingsId,
48 'settings' => $settings,
49 ]);
50 } catch (ValidationException $exception) {
51 return $this->sendError($exception->errors(), 422);
52 }
53 }
54
55 public function remove(SettingsService $settingsService)
56 {
57 $settingsService->remove($this->request->all());
58
59 return $this->sendSuccess([]);
60 }
61
62 public function customizer(Customizer $customizer, $id)
63 {
64 return $this->sendSuccess($customizer->get($id));
65 }
66
67 public function storeCustomizer(Customizer $customizer, $id)
68 {
69 try {
70 $customizer->store($this->request->all());
71
72 return $this->sendSuccess([
73 'message' => __('Custom CSS & JS successfully saved.', 'fluentform'),
74 ]);
75 } catch (Exception $e) {
76 return $this->sendError([
77 'message' => $e->getMessage(),
78 ], 423);
79 }
80 }
81
82 public function storeEntryColumns(SubmissionService $submissionService, $id)
83 {
84 try {
85 $submissionService->storeColumnSettings($this->request->all());
86
87 return $this->sendSuccess([
88 'message' => __('The column display order has been saved.', 'fluentform'),
89 ]);
90 } catch (Exception $e) {
91 return $this->sendError([
92 'message' => $e->getMessage(),
93 ], 423);
94 }
95 }
96
97 public function conversationalDesign(SettingsService $settingsService, $formId)
98 {
99 try {
100 return $this->sendSuccess($settingsService->conversationalDesign($formId));
101 } catch (Exception $e) {
102 return $this->sendError([
103 'message' => $e->getMessage(),
104 ], 423);
105 }
106 }
107
108 public function storeConversationalDesign(SettingsService $settingsService, $formId)
109 {
110 try {
111 return $this->sendSuccess($settingsService->storeConversationalDesign($this->request->all(), $formId));
112 } catch (Exception $e) {
113 return $this->sendError([
114 'message' => $e->getMessage(),
115 ], 423);
116 }
117 }
118
119 public function getPreset(SettingsService $settingsService, $formId)
120 {
121 try {
122 return $this->sendSuccess($settingsService->getPreset($formId));
123 } catch (Exception $e) {
124 return $this->sendError([
125 'message' => $e->getMessage(),
126 ], 423);
127 }
128 }
129
130 public function savePreset(SettingsService $settingsService)
131 {
132 try {
133 return $this->sendSuccess($settingsService->savePreset($this->request->all()));
134 } catch (Exception $e) {
135 return $this->sendError([
136 'message' => $e->getMessage(),
137 ], 423);
138 }
139 }
140 }
141