Type of Fields
Types of the fields of the settings manifest.json
Let’s examine the possible types of fields that can be specified in the settings section of the manifest.json file. All possible types are listed in the table, with a description of their properties, for each type are examples of using it in manifest.json and, if necessary, an example of the localization file from the i18n /
Type | Description |
---|---|
text | Text field |
pass | Password input field |
users | A list of users of the system with 1 text field per each will be displayed, required if you need to enter some information for each employee, for example, an internal telephone number for IP telephony |
users_lp | A list of users of the system with 2 fields (login, password) will be displayed for each. |
custom | Custom fields are discussed in detail in the Advanced widget settings section. |
Below are examples of applying field types in the manifest.json file
Types of text and pass fields.
Example description in manifest.json.
{
"widget":{
"name": "widget.name",
"description": "widget.description",
"short_description": "widget.short_description",
"code": "new_widget",
"secret_key": "57009cb5048a72191f25b01355c17d10dc349df20d4fe2ad0c69930223e13955",
"version": "1.0.0",
"interface_version" : 2,
"init_once" : false,
"locale":[
"ru",
"en"
],
"installation": true
},
"locations":[
"ccard-1",
"clist-1"
],
"settings":{
"login":{
"name": "settings.login", //indicates the localization file in the i18n folder
"type": "text", //type: text field
"required": false
},
"password":{
"name": "settings.password",//indicates the localization file in the i18n
"type": "pass", //type: password
"required": false
}
}
}
i18n / en.json in this case should have the following form
{
"widget":{
"name":"Test widget",
"short_description":"Short one",
"description":"ENGLISH: #SUBDOMAIN# #HOST# #LOGIN# #API_HASH# #USER_ID# #ACCOUNT_ID#
#LINK#http://example.test/link_to_copy#/LINK# Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Quisque posuere
tristique nisl vitae fringilla. Nam purus tellus, vestibulum at interdum id, cursus sed lacus.
Pellentesque
vitae ligula
sem. Proin imperdiet luctus arcu sed vulputate. Pellentesque malesuada tincidunt lectus eu congue. Pellentesque habitant
morbi tristique
senectus et netus et malesuada fames. "
},
"settings":{
"login":"User login",
"password":"User password"
}
}
The type of the users field.
Let’s consider an example of a field of type: users. This type of field is used when it is necessary to present a list of users of the system with text fields, it is required in case you need to enter some information for each employee, for example, an internal phone number for IP telephony). The following is an example of a manifest.json.
In the following examples, for the sake of brevity, the contents of the widgets, locations, and others are omitted, their values are similar to the previous examples.
{
"widget":{
},
"locations":[
],
"settings":{
"login":{
},
"password":{
},
"phones":{
"name": "settings.user_phones",
"type": "users",
"required": true
}
}
}
i18n / en.json in this case should have the following form:
{
"widget":{
},
"settings":{
"login":"User login",
"password":"User password",
"user_phones":"Phones list"
}
}
The type of field users_lp
This type of field is an extended version of the users field. The difference is that for each user there are two fields, and not one as in the case of users. It is used when each employee needs to provide pairs of values, for example: login-password. The following is an example of the manifest.json file.
{
"widget":{},
"locations":[],
"settings":{
"auth_data":{
"name":"settings.auth_data",
"type":"users_lp",
"required": false
}
}
}
Also, it is possible to add custom fields of type custom. For more information see here