Use the settings API to access the item settings in raw and interpolated formats. The item settings are defined in the ./settings.json
file. You can access the item settings using the API methods in any Vue file of your project.
The settings API exposes its methods using this context:
this.$settings
Usage
You can use the settings API methods to get the item settings: the template name and ID, localization, navigation, and other information from the ./settings.json
file. Use the settings API methods with the this.$settings
context in a Vue file: for example, a slide index.vue
file or the App.vue
file in emails, landing pages, and messenger ads.
Methods
The following methods are available for the settings API.
Method | Description |
| Returns an object with the non-interpolated item settings stored in the |
| Returns an object with the interpolated item settings. This means that all the placeholders for the field values are replaced with the actual values. The |
| Returns an object with the interpolated settings that are stored by the defined path. The |
| Returns an object with the settings of a specific target system. |
| Returns an object with the non-interpolated settings that are stored by the defined path. The |
|
|
| Returns the value for the |
| Returns the value for the |
Parameters
The following parameters are available for the settings API methods.
Parameter | Type | Description |
| String | The target system name. For example, |
| String | The path to the settings in the |
| Object | Specifies the ID of the slide and chapter to interpolate their settings. This is usually used to interpolate the |
| Any | If the |
getRaw
The getRaw
method returns the non-interpolated values (placeholders) from the ./settings.json
file: you see the values exactly as they're in the repository.
this.$settings.getRaw()
get
The get
method returns the interpolated settings (actual values instead of placeholders) from the ./settings.json
file.
this.$settings.get()
getClmSettings
The getClmSettings
method returns the object with the e-Detailer or messenger ad settings for the specified target system.
To get the settings for the specific target system, add the target system name as the parameter to the getClmSettings()
method.
this.$settings.getClmSettings('clmName')
Parameters of getClmSettings
The getClmSettings
method has the following parameters.
Parameter | Type | Default | Description |
| String | NA | Optional parameter. Specify the target system to show its settings. For example, |
getByPath
The getByPath
method returns the interpolated value for specified setting in your item from the settings.json
file. Add the full path to this setting as the keypath
parameter to the getByPath()
method to show the field value.
this.$settings.getByPath('keypath')
Parameters of getByPath
The getByPath
method has the following parameters.
Parameter | Type | Default | Description |
| String | NA | Required parameter. Provide the full path to the setting in the |
| Object |
| Optional parameter. Use this parameter to redefine the slide and chapter ID to interpolate their values. The |
| String | NA | Optional parameter. If |
Usage of options
Use the options
parameter with the getByPath
method to redefine the slide or chapter ID. The name
and id
fields are available for interpolation.
this.$settings.getByPath('clms.irep.assetFileNameTemplate', { slide: { id: 'home', }, chapter: { id: 'home', } });
Use the defaultValue
parameter to define the value for the setting that doesn't exist in the settings.json
file.
this.$settings.getByPath('defaultValue')
Add the options
parameter and enter the defaultValue
parameter that you want to return if that value doesn't exist in the ./settings.json
file.
this.$settings.getByPath('test.value', options, 'defaultValue')
getRawByPath
The getRawByPath
method returns the non-interpolated values (placeholders) for the specified setting in your item from the ./settings.json
file. This method has the same parameters as the getByPath method.
this.$settings.getRawByPath('keypath', options, 'defaultValue')
setSettings
The setSettings
method updates the item settings values stored in the browser memory. The app uses the new values set by this method instead of the values in the project ./settings.json
file during the current session in the browser.
this.$settings.setSettings(settingJson)
Parameters of setSettings
The setSettings
method has the following parameters.
Parameter | Type | Default | Description |
| Object |
| Required parameter. Redefine one or more values from the |
getCurrentTheme
The getCurrentTheme
method returns the value for the current
theme field in the ./settings.json
file.
this.$settings.getCurrentTheme()
getCurrentScheme
The getCurrentScheme
method returns the value for the scheme field in the ./settings.json
file. This is the color scheme for the current theme.
this.$settings.getCurrentScheme()
For more information, see settings API.