DataSources often need settings which come from the App or from a settings dialog. The ConfigMask builds a configuration token which will be used to get this setting, and also ensures that cachings mechanims vary the cache based on the result of the configuration.
This is part of the new API for DataSources released in 2sxc 9.13.
How To Use ConfigMask
Here's a simple example of the constructor of the DnnFormAndList DataSource, which expects 3 settings:
Using ConfigMask in the FormAndList
// Specify what out-streams this data-source provides. Usually just one, called "Default"
// Register the configurations we want as tokens, so that the values will be injected later on
This example adds 3 configuration masks - let's find out what exactly happens.
Tokens for Configuration Injection
The EAV-System has a sophisticated system to get configuration based on tokens. You can read about configuration injection using tokens in the wiki.
Registering and Resolving these Tokens with ConfigMask
Internally a lot happens, but you just need to know the ConfigMask command. The syntax is:
This will do the following
- Add this mask (using this name) to the configuration list
- register this key to be cache-relevant
To use the values, you will also need to ensure that configuration is parsed. This is handled in the next blog.
There is more to discover, for that, read the ConfigMask documentation in the wiki.
Love from Switzerland,