Updating themes for 1.4.5 version, and noticed that all of my OPTION_TYPE_TEXTAREA and OPTION_TYPE_TEXTBOX options were being returned as serialized arrays when using the getOption function in the theme. My plugins do not, just my themes. Hard to compare with included themes since none of them use these option types. I think this was an issue before 1.4.5, it was probably the cause of the issue in this thread:
http://www.zenphoto.org/support/topic.php?id=90536
For example, when I have this entered in the backend OPTION_TYPE_TEXTAREA option:
body{background:red;}
I get this on the frontend when I echo the option:
a:1:{s:5:"en_US";s:21:"body{background:red;}";}
Any ideas?
That is correct now, all multilingual capable fields are now stored as serialized arrays always. Formerly they only were if you were in multilingual mode which caused some issues if you switched back. That's because it was changed.
Fields that are stored plain will be changed on re-saving like titles for example.
I had forgotten about that change myself actually and stumble upon it recently (https://github.com/zenphoto/zenphoto/issues/448).
There is a function to get the right one: http://www.zenphoto.org/documentation/core/_functions-i18n.php.html#functionget_language_string
Ah ok, I see that now, thanks. For the benefit of others, there is a way to turn off multilingual mode in an option array in your themeoptions.php file:
'multilingual' => false
This is convenient when there is no reason for the option to be multilingual, like my example above (css), or number parameters for example.
Correct. All documented within the demo plugin here:
https://github.com/zenphoto/DevTools/blob/master/demo_plugin-and-theme/demo_plugin/zenphoto_demoplugin.php
(which is linked from here http://www.zenphoto.org/news/zenphoto-plugin-architecture as well)
"For the benefit of others, there is a way to turn off multilingual mode in an option array in your themeoptions.php file:
'multilingual' => false"
I'm having the same issue and tried to disable multilingual as above...after a couple hours, unfortunately not having much luck. Tried a few different setups but still getting arrays. Can someone please specify how/where to add this option to themeoptions.php?
You always get arrays no matter if enabled or not. Multiple langauges ares stored in one database field as serialized arrays. If they wouldn't if you disable multilingual and re-save a multilingual page you would loose all the multilingual content.
It was that way before and changed for that exact reason. You can get the one of the current language using this function: http://www.zenphoto.org/documentation/core/_functions-i18n.php.html#functionget_language_string
That code belongs in the array that defines the particular option. For instance: gettext('Theme logo') => array('key' => 'Theme_logo', 'type' => OPTION_TYPE_TEXTBOX, 'multilingual' => 0, 'order' => 8, 'desc' => gettext('The text for the theme logo'))
Note that if you already have saved the option in multi-lingual mode you will need to clear it out before saving in single text mode.