Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"AdminPageFramework_Properties::getAllSettings" #12

Closed
soderlind opened this issue Oct 22, 2013 · 4 comments
Closed

"AdminPageFramework_Properties::getAllSettings" #12

soderlind opened this issue Oct 22, 2013 · 4 comments
Milestone

Comments

@soderlind
Copy link

AdminPageFramework_Properties::getOptions() only get saved settings , I'd like to get the default settings.

@michaeluno
Copy link
Owner

I don't see the necessity of it as field default values are defined by the user. You may be talking about a different one so can you show an example how you would use it?

[Edit]
I'm getting what you mean now. Unsaved values and their keys are not included in the result of the getOptions() method. Are you saying that you need all the settings' array keys regardless they are saved or not?

@soderlind
Copy link
Author

I have a 5-tab settings page, This is my do_ + extended class name:

public function do_Read_Offline_Settings() {
    submit_button();
    echo $this->oDebug->getArray( get_option( 'Read_Offline_Settings' ) );       
}

If I'm on settings tab 1, it will only save the settings on that page (i.e. the user must save on each tab page).

If I had a method that returned all default settings, I could compare them with the settings saved (get_option). That is, I wouldn't have to maintain an array with my default settings AND the settings page.

btw, here's a dump of my settings (went through all settings tabs and click the save button to store them):

Array
(
    [read_offline_epub] => Array
        (
            [epub] => Array
                (
                    [cover_image] => 
                    [style_editor] => 
                )

        )

    [read_offline_pdf] => Array
        (
            [header_footer] => Array
                (
                    [select_mixed] => Array
                        (
                            [left] => 
                            [center] => 
                            [right] => 
                        )

                    [select_footer] => Array
                        (
                            [left] => 
                            [center] => 
                            [right] => 
                        )

                )

            [pdf_watermark] => Array
                (
                    [pdf_watermark_text] => 
                    [pdf_watermark_image] => 
                    [pdf_watermark_tranparency] => 0
                )

            [pdf_protection] => Array
                (
                    [pdf_protection_password_owner] => 
                    [pdf_protection_password_user] => 
                    [pdf_protection_can_do] => Array
                        (
                            [copy] => 0
                            [print] => 0
                            [modify] => 0
                        )

                )

        )

    [read_offline_options] => Array
        (
            [what] => Array
                (
                    [formats] => Array
                        (
                            [pdf] => 1
                            [epub] => 1
                            [mobi] => 1
                            [docx] => 0
                        )

                )

            [where] => Array
                (
                    [placements] => Array
                        (
                            [top] => 1
                            [bottom] => 1
                        )

                    [post_types] => Array
                        (
                            [post] => 1
                            [page] => 1
                            [acf] => 0
                            [apf_posts] => 0
                        )

                )

            [how] => Array
                (
                    [link_text] => Read Offline: 
                    [icons_only] => 0
                )

            [misc] => Array
                (
                    [google] => 1
                )

        )

)

@michaeluno
Copy link
Owner

I see. I'll see how it can be achieved.

michaeluno added a commit that referenced this issue Jan 9, 2014
…gardless of the page where the user submits the form.

* Changed: it to store all added sections and fields into the property object regardless of they belong to currently loading page and with some other conditions.
* Added: the getDefaultOptions() method. Resolves #12.
@michaeluno
Copy link
Owner

In v3 beta, default option values in other tabs/pages will be merged when the user submit a form in one of the tabs/pages of the framework.

The method is getDefaultOptions() and it is defined in the AdminPageFramework_Property_Page class. It is meant to be an internal method and I might move it to a form element class so it is not recommended to use it though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants