---
title: Settings script reference
project: CMS
version: 1.0
section: development
language: en
license: MIT
url: https://totaljs.es/docs/cms/1-0/development/settings-api/
updated: 2026-11-20T06:51:42.966Z
---

# Settings script reference

> The functions of the script in the settings section and what they receive.

The first `<script>` inside `<settings>` runs in the admin. It can export these functions. Each receives the configuration of the instance and its wrapper in the page, as a jQuery element:

```js
exports.save = function(config, el) {
	el.find('.CLASS-box b').text(config.name);
};
```

An error in a function is shown as a warning in the console of the browser, and the configuration is still saved.

## API

### exports.load = function(config, el) {}

Type: `event`

Runs when the user opens the settings of an instance.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `config` | `Object` | yes |  | The configuration of the instance. |
| `el` | `jQuery` | yes |  | The wrapper of the instance. |

Change `config` to change the values that the form shows. **Gallery** uses it to open the file picker.

### exports.save = function(config, el) {}

Type: `event`

Runs when the user clicks APPLY.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `config` | `Object` | yes |  | The new configuration, without the hide options. |
| `el` | `jQuery` | yes |  | The wrapper of the instance. |

Update the HTML of the instance to match the new values. After it, CMS stores `config` in the instance and adds or removes the hide classes.

Example: Switch a class with a checkbox
```js
exports.save = function(config, el) {
	el.find('> div').tclass('CLASS-radius', config.rounded);
};
```

### exports.check = function(config, el) {}

Type: `event`

Runs for each instance when the editor opens the page.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `config` | `Object` | yes |  | The configuration of the instance. |
| `el` | `jQuery` | yes |  | The wrapper of the instance. |

It runs again when the list of installed widgets changes. Use it to bring older instances up to date.
