Module settings are global properties used in server-side scripting for widgets, module business processes, and for creating API methods. For example, you can add properties to store a token or an API key.
To access parameters in scripts, use:
To configure or edit module settings:
- Go to Administration> Modules.
- Hover over the module and click on the gear icon that appears.
- Go to the Settings tab.
- Click +Add and fill in the fields in the Create Property window:
- Display name. The name of the property that will be displayed on different forms of the module and in its settings;
- Property name. The name of the property used when working with API, scripts;
- Tip. Additional information about the property;
- Type. The type of the property, for example, "String";
- Search and sort by field. The value of this field will be used as a parameter for the search if you select this option;
- Full-text search. The field value is used in a full-text search.
- Set a formula for the field. This option is available only for fields of the String, Number, and Money type. You can specify a formula by which the system will automatically calculate the value for this property. Read more in the article "Calculated fields."
- Show only when a condition is met. This option allows you to hide/show the property based on your specific conditions. Read more in the article "Calculated fields."
After you have specified all the settings, click Save.
The settings you have created are added by default to the module's connection page. The user will see them by clicking on the module's name in the Administration section.
You can change the settings display. For example, hide some of the settings, add fields for checking tokens, or customize the page to immediately display the necessary data from an external service.
To do this, click Change form on the Settings tab of the selected module.
The Interface Designer will open, where you can set up custom widget for settings display. When you go to the Designer, the Template tab immediately opens. It contains a field for modeling in the center and all available widgets on the right. The Properties tab displays the module's settings.
On the Context tab you can add the properties that will be used in widget's scripts later. Read more about this in the article "Context Types" and the article "System Data Types." On the Scripts tab, you can write scripts that define widget behavior. When you finish setting up the widget, don't forget to publish it.