phemellc / yii2-settings

Yii2 Settings Module
Other
151 stars 74 forks source link

How to use type array? #32

Closed schmunk42 closed 6 years ago

schmunk42 commented 8 years ago

I couldn't figure it out, how can I write and read array via PHP code and WebUI? Could you add an example to the docs?

arisk commented 8 years ago

Currently there's no support for settings to be arrays. I guess we could check if gettype returns array and serialize it before storing it in the DB. Another option could be JSON? For the WebUI part any suggestions are welcome.

schmunk42 commented 8 years ago

JSON for arrays would be fine.

Maybe of interest... This is a great JSON editor: https://github.com/DevGroup-ru/yii2-jsoneditor For string fields, this would be nice: https://github.com/trntv/yii2-aceeditor Here's a wip JSON validator: https://github.com/dmstr/yii2-validators/blob/master/src/JsonValidator.php

arisk commented 8 years ago

Thanks for the suggestions. I'll look into them.