redux-framework icon indicating copy to clipboard operation
redux-framework copied to clipboard

'sorter' field not auto-saving on load

Open tmariovlad opened this issue 12 years ago • 3 comments

I'm having 2 problems with the sections with "type" => "sorter". Although I have 'save_defaults' => true (and everything else is saving) the defaults of the sorter type field don't get sent into the database.

$this->sections[] = array(
    'title' => __('Home Layout', 'redux-framework-666'),
    'desc' => __('Here you can set which sections show up on the homepage', 'redux-framework-666'),
    'icon' => 'el-icon-lines',
    'fields' => array(
        array(
            "id" => "section-select",
            "type" => "sorter",
            "title" => "Homepage Layout Manager",
            "desc" => "Organize how you want the layout to appear on the homepage",
            'options' => array(
                "disabled" => array("my@55" => "cr@p"),
                "enabled" => array(
                    "headline" => "Headline",
                    "services" => "Services",       
                    "quote" => "Quote",
                    "team" => "The Team",
                    "slider" => "Slider",
                    "work" => "Our Work",
                    "button" => "Button",
                    "pricing" => "Pricing",
                    "social" => "Social Links",
                    "contact" => "Contact",
                    "footer" => "Footer"
                )
            )
        )
    )
);

I also did a print_r on the global redux array and I get all the other arrays, but "section-select" is set to empty. (after doing a global reset/or loading it once to trigger the save_defaults option)

P.S. Another issue I noticed is that after you manually save the sorter array with the "Save Changes" button you also get inside that array an index called "placebo" with the value "placebo":

Array
(
    [last_tab] => 
    [logo] => Array
        (
            [url] => http://placehold.it/83&text=Logo
            [id] => 
            [height] => 
            [width] => 
            [thumbnail] => 
        )

    [favicon] => Array
        (
            [url] => /wordpress/wp-content/themes/666/img/icons/666-menu-icon.png
            [id] => 
            [height] => 
            [width] => 
            [thumbnail] => 
        )

    [page_title] => 666. A one page scrolling responsive template.
    [section-select] => Array
        (
            [disabled] => Array
                (
                    [placebo] => placebo
                    [my ass] => crap
                )

            [enabled] => Array
                (
                    [placebo] => placebo
                    [headline] => Headline
                    [services] => Services
                    [quote] => Quote
                    [team] => The Team
                    [slider] => Slider
                    [work] => Our Work
                    [button] => Button
                    [pricing] => Pricing
                    [social] => Social Links
                    [contact] => Contact
                    [footer] => Footer
                )

        )

    [REDUX_last_saved] => 1391313334
    [REDUX_imported] => 
)

Redux Version: 3.1.5 (latest as of 2/2/2014 4:00AM GMT) Wordpress Version: 3.8.1

P.P.S. I'm a beginner with PHP, I apologize if it's my fault or something I wrote doesn't make sense.

tmariovlad avatar Feb 02 '14 04:02 tmariovlad

Oh, good point. I'll look into it as I can.

dovy avatar Feb 03 '14 05:02 dovy

I found a fix for this. I'll push it later tonight.

kprovance avatar Feb 07 '14 01:02 kprovance

Ok, pushed a fix, version 3.1.5.11. You'll need to reset the section for the defaults to save, should there already be settings in the database.

kprovance avatar Feb 07 '14 03:02 kprovance