Difference between #11 and #12 of
How to store array/widget configuration to the database with config validation rules

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 parseConfigTags($config) {
return unserialize(strtr($config, [
'{{homeUrl}}' => Yii::$app->homeUrl,
'{{otherTag1}}' => 'Value 1'
]));
}
[...]
2 3
41 followers
Viewed: 23 686 times
Version: 2.0
Category: Tutorials
Written by: Kartik V
Last updated by: Kartik V
Created on: May 6, 2014
Last updated: 9 years ago
Update Article

Revisions

View all history