evertiro / historical-redux2

A simple, easily extendable options framework for WordPress based on NHP Theme Options Framework.
http://reduxframework.com
Other
105 stars 43 forks source link

New handling of std values #63

Closed denis0706 closed 11 years ago

denis0706 commented 11 years ago

I think we can improve handling of std values. In some cases it is needed std values to be set when updating. If you don't want to set std in DB, just don't set std in options.php If std is set in options.php and std_show=true - default options is just showing, If std is set in options.php and std_show=false - default options is set.

What do you think about this?

signo commented 11 years ago

Could you please elaborate the scenario when you need std values saved in the db?

As of now if std_show = true when you call the get() method it will return the std value, so you will always get back the std as if it was saved in the db. To make it clearer the get() method behaves in the following way:

the field 'test' is defined as a number with a std value of 4, the following statement $var = redux->get('test', 0) will return 4 if the value is not set and a 0 if the std is not set, that is because get() looks first for the saved value, next for the std value and last for the default value passed as a parameter.

Hope this makes it clearer.

evertiro commented 11 years ago

I think this is handled... if not, please re-open.