PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 4.3.17
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v4.3.17
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 / Modules / Form / Settings / EntryColumnViewSettings.php

EntryColumnViewSettings.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 4.3.17, at app/Modules/Form/Settings/EntryColumnViewSettings.php

82 lines 2.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\Modules\Form\Settings;
4
5 class EntryColumnViewSettings
6 {
7 /**
8 * Request object
9 *
10 * @var \FluentForm\Framework\Request\Request $request
11 */
12 protected $request;
13
14 public function __construct()
15 {
16 $this->request = wpFluentForm('request');
17 }
18
19 /**
20 * Save settings for visible entry columns
21 *
22 * @return void
23 */
24 public function saveVisibleColumnsAjax()
25 {
26 $formId = absint($this->request->get('form_id'));
27 $columns = wp_unslash($this->request->get('visible_columns'));
28
29 $this->store($formId, '_visible_columns', $columns);
30
31 wp_send_json_success();
32 }
33
34 /**
35 * Save settings for entry column display order
36 */
37 public function saveEntryColumnsOrderAjax()
38 {
39 $formId = absint($this->request->get('form_id'));
40 $columns = wp_unslash($this->request->get('columns_order'));
41
42 $this->store($formId, '_columns_order', $columns);
43
44 wp_send_json_success();
45 }
46
47 /**
48 * Reset column display order settings
49 */
50 public function resetEntryDisplaySettings()
51 {
52 $formId = absint($this->request->get('form_id'));
53
54 $this->store($formId, '_columns_order', null);
55
56 wp_send_json_success();
57 }
58
59 protected function store($formId, $metaKey, $metaValue)
60 {
61 $row = wpFluent()->table('fluentform_form_meta')
62 ->where('form_id', $formId)
63 ->where('meta_key', $metaKey)
64 ->first();
65
66 if (!$row) {
67 return wpFluent()->table('fluentform_form_meta')
68 ->insert([
69 'form_id' => $formId,
70 'meta_key' => $metaKey,
71 'value' => $metaValue,
72 ]);
73 }
74
75 return wpFluent()->table('fluentform_form_meta')
76 ->where('id', $row->id)
77 ->update([
78 'value' => $metaValue,
79 ]);
80 }
81 }
82