How to store array/widget configuration to the database with config validation rules

Comparing #11 with #12

Revision #12 was created by angelcoding angelcoding on May 6, 2014, 8:35:03 PM.

Fixed function name typo and added note to show that tag parsing can also be made using a custom validator

Content

[...]
Note the tag `{{homeUrl}}` will be dynamically replaced at runtime.


### 3. Validating Config and running widget
You can use your own custom validator to parse any tags (as called in the example above but not yet described here) or simply use a 'parseTags' function such as in the following example ... ```php // Parse tags public static function parseConfigTags($config) {
return unserialize(strtr($config, [
'{{homeUrl}}' => Yii::$app->homeUrl,
'{{otherTag1}}' => 'Value 1'
]));
}
[...]