Settings
Theme settings enable you to allow global configurations across your site. They work great when you want to provide easy access for your users to change global design elements, such as logos, icons, or tile colors. A user can edit settings in the Settings UI of the Respond application.
Creating a Setting
Settings are stored on the theme under resources/theme-name/.private/settings.json
. They are copied to the site under resources/sites/site-name/settings.json
. Settings are stored in JSON in the following format.
{ "id": "theme-logo", "label": "Logo", "description": "Primary logo of the site", "type": "image", "value": "files\/sample-logo.png", "sets": "attribute", "attribute": "src" }
Setting | Description |
---|---|
id | The unique identifier for the setting. |
label | The label shown in the settings UI. |
description | The description shown in the settings UI. |
type | The type of input shown in the settings UI (text or image are supported). |
value | The default value of the setting. |
sets | What is set by the setting (e.g. attribute) |
attribute | The attribute that is set by the setting. |
Reference Settings in Code
You reference a setting using the id
of the setting as an attribute for the element.
<img theme-logo src="files/persistence.png">