Revision #12 has been created by angelcoding on May 6, 2014, 8:35:03 PM with the memo:
Fixed function name typo and added note to show that tag parsing can also be made using a custom validator
« previous (#11) next (#13) »
Changes
Title
unchanged
How to store array/widget configuration to the database with config validation rules
Category
unchanged
Tutorials
Yii version
unchanged
Tags
unchanged
yii2, dynamic, model, save, widget, config, database, db, store, array
Content
changed
[...]
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 parse
ConfigTags($config) {
return unserialize(strtr($config, [
'{{homeUrl}}' => Yii::$app->homeUrl,
'{{otherTag1}}' => 'Value 1'
]));
}[...]