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.

  1. {
  2. "widget":{
  3.   "name": "widget.name",
  4.   "description": "widget.description",
  5.   "short_description": "widget.short_description",
  6.   "code": "new_widget",
  7.   "secret_key": "57009cb5048a72191f25b01355c17d10dc349df20d4fe2ad0c69930223e13955",
  8.   "version": "1.0.0",
  9.   "interface_version" : 2,
  10.   "init_once" : false,
  11.   "locale":[
  12.         "ru",
  13.         "en"
  14.         ],
  15.     "installation": true
  16.     },
  17. "locations":[
  18.     "ccard-1",
  19.     "clist-1"
  20.     ],
  21. "settings":{
  22.     "login":{
  23.         "name": "settings.login", //indicates the localization file in the i18n folder
  24.         "type": "text", //type: text field
  25.         "required": false
  26.         },
  27.     "password":{
  28.         "name": "settings.password",//indicates the localization file in the i18n
  29.         "type": "pass", //type: password
  30.         "required": false
  31.         }
  32.   }
  33. }
i18n / en.json in this case should have the following form
  1. {
  2.     "widget":{
  3.         "name":"Test widget",
  4.         "short_description":"Short one",
  5.         "description":"ENGLISH: #SUBDOMAIN# #HOST# #LOGIN# #API_HASH# #USER_ID# #ACCOUNT_ID#
  6. #LINK#http://example.test/link_to_copy#/LINK# Lorem ipsum dolor sit amet,  consectetur adipiscing elit. <br/>
  7. <strong>Quisque posuere
  8. tristique nisl  vitae fringilla. Nam purus tellus, vestibulum at interdum id, cursus sed lacus.</strong><br/>Pellentesque
  9. vitae ligula
  10. sem. Proin imperdiet luctus arcu sed vulputate. Pellentesque malesuada tincidunt lectus eu congue. Pellentesque habitant
  11. morbi tristique
  12. senectus et netus et malesuada fames. "
  13.     },
  14.     "settings":{
  15.         "login":"User login",
  16.         "password":"User password"
  17.         }
  18. }

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.
  1. {
  2.     "widget":{            
  3.             },
  4.     "locations":[
  5.             ],
  6.     "settings":{
  7.                 "login":{                        
  8.                         },
  9.                 "password":{                        
  10.                         },
  11.                 "phones":{
  12.                         "name": "settings.user_phones",
  13.                         "type": "users",
  14.                         "required": true
  15.                         }
  16.                 }
  17. }
i18n / en.json in this case should have the following form:
  1. {
  2. "widget":{
  3.     },
  4.     "settings":{
  5.         "login":"User login",
  6.         "password":"User password",
  7.         "user_phones":"Phones list"
  8.         }
  9. }
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.
  1. {
  2. "widget":{},
  3. "locations":[],
  4. "settings":{
  5.     "auth_data":{
  6.         "name":"settings.auth_data",
  7.         "type":"users_lp",
  8.         "required": false
  9.     }
  10.   }
  11. }
Also, it is possible to add custom fields of type custom. For more information see here