An object representing a theme.
Property | Type | Description |
---|---|---|
uid | integer | The unique identifier of the Theme. |
name | string | The name of the Theme. |
active | boolean | Whether the Theme is active for customers. |
conditions | Conditions | Conditions for when the Theme should be considered active. |
created | string | Date and time of when the Theme was created. |
changed | string | Date and time of when the Theme was last changed. |
params | object | The parameters of the Theme. |
theme | string | Name of the theme-component. |
version | string | Version of the theme-component. |
parent | integer | The unique identifier of the parent Theme. |
ssr | boolean | Whether the Theme has Server-Side Rendering (SSR) enabled. |
description | string | A description of the Theme. |
webshop | integer | The unique identifier of the Webshop that the Theme belongs to. |
engine | string | The theme engine used by the theme "diversity" , "tpl" or "unity" (read only for existing themes). |
The different conditions that may be set for a Theme.
Property | Type | Description |
---|---|---|
deviceType | string | At present, "mobile" is the only existing device-type value. If not "mobile" , deviceType does not exist.) |
Takes a filter object and returns the number of themes found, as an integer.
A filter object specifying which themes to count. See Filter objects on the page List selection.
The request below returns the number of active themes.
Theme.count({
"/active": true
})
Creates a new theme. This is shorthand for set with the uniquer identifier null
.
Parameter | Description |
---|---|
patch | An object containing the properties and values to set for the new theme. |
query | A query specifying what to return after theme creation has been successful (optional). See Query language. |
Theme.create({
"name": "PurpleMobile",
"conditions": {
"deviceType": "mobile"
},
"params": {
"layout": "bootstrap-layout-funky",
"settings": {
"colorScheme": "purplish",
"centerfold": [
{
"component": "tws-minicart",
"settings": {
"type": "small"
}
}
]
}
}
})
Deletes a theme for a given unique identifier.
The unique identifier of the theme to be deleted.
Theme.delete(2423)
Code | Message | Description |
---|---|---|
-32602 | Invalid Params | If the object does not exist or is unavailable. |
1006 | Forbidden | Method call is not allowed. |
Retreives a specific theme.
Parameter | Description |
---|---|
uid | The unique identifier of the theme. |
query | Which info to return. See Query language. |
Theme.get(1234, true)
Fetches the JSON Schema which can be used for client-side validation.
The unique identifier of a theme or null
to create a new theme.
Fetches multiple themes as an array.
Parameter | Description |
---|---|
query | Which info to return. See Query language. |
selection | Which themes to list. See List selection. |
Theme.list("name", {
"filters": {
"/active": true
}
})
Selects and returns a Theme that satisfies the current connection and context. This method returns only ONE Theme which may be ANY of the Themes that are suitable.
Parameter | Description |
---|---|
query | Which info to return. See Query language. |
From a mobile device:
Theme.select("name")
Creates or updates a theme.
Parameter | Description |
---|---|
uid | The unique identifier of the theme or null to create a new theme. |
patch | An object containing the properties and values to set for the theme. |
query | A query specifying what to return after a successful set (optional). See Query language. |
Theme.set(2423, {
"active": true,
"conditions": {
"deviceType": "mobile"
},
"name": "BlackMobile",
"params": {
"settings": {
"colorScheme": "black"
}
}
}, [
"name",
"active",
"params"
])