# fluentform/4.3.21/app/Modules/Form/Settings/EntryColumnViewSettings.php

Fluent Forms – Customizable Contact Forms, Survey, Quiz, &amp; Conversational Form Builder, version 4.3.21. 82 lines.

- Page: https://pluginprobe.com/plugins/fluentform/4.3.21/code/app/Modules/Form/Settings/EntryColumnViewSettings.php
- Raw: https://pluginprobe.com/plugins/fluentform/4.3.21/raw/app/Modules/Form/Settings/EntryColumnViewSettings.php
- Modified: 2022-10-27T17:40:16+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluentform/4.3.21/code/app/Modules/Form/Settings/EntryColumnViewSettings.php#L10-L20`.

```php
<?php

namespace FluentForm\App\Modules\Form\Settings;

class EntryColumnViewSettings
{
    /**
     * Request object
     *
     * @var \FluentForm\Framework\Request\Request $request
     */
    protected $request;

    public function __construct()
    {
        $this->request = wpFluentForm('request');
    }

    /**
     * Save settings for visible entry columns
     *
     * @return void
     */
    public function saveVisibleColumnsAjax()
    {
        $formId = absint($this->request->get('form_id'));
        $columns = wp_unslash($this->request->get('visible_columns'));

        $this->store($formId, '_visible_columns', $columns);

        wp_send_json_success();
    }

    /**
     * Save settings for entry column display order
     */
    public function saveEntryColumnsOrderAjax()
    {
        $formId = absint($this->request->get('form_id'));
        $columns = wp_unslash($this->request->get('columns_order'));

        $this->store($formId, '_columns_order', $columns);

        wp_send_json_success();
    }

    /**
     * Reset column display order settings
     */
    public function resetEntryDisplaySettings()
    {
        $formId = absint($this->request->get('form_id'));

        $this->store($formId, '_columns_order', null);

        wp_send_json_success();
    }

    protected function store($formId, $metaKey, $metaValue)
    {
        $row = wpFluent()->table('fluentform_form_meta')
                         ->where('form_id', $formId)
                         ->where('meta_key', $metaKey)
                         ->first();

        if (!$row) {
            return wpFluent()->table('fluentform_form_meta')
                             ->insert([
                                 'form_id'  => $formId,
                                 'meta_key' => $metaKey,
                                 'value'    => $metaValue,
                             ]);
        }

        return wpFluent()->table('fluentform_form_meta')
                         ->where('id', $row->id)
                         ->update([
                             'value' => $metaValue,
                         ]);
    }
}

```
