appinfo.json for Custom Field Editors
This file is a required and includes the configuration metadata needed for the editor. Some properties are necessary for the editor to function, some are optional. The following is a sample appinfo.json:
{
"type":"fieldeditor",
"name":"Sample Text field",
"single":true,
"multiple":true,
"handlesMultiple":false,
"supportedDatatypes":["text"],
"autoresize":true,
"validation":true,
"useDefaultFormView":false
}
Table 7-1 appinfo.json Configuration Properties
Property | Value | Required | Type |
---|---|---|---|
type | The component type. For custom field editors, the type is
fieldeditor and is the same for all editors. It
should not be changed.
|
required | string |
name | The name displayed in the Content Type field settings editor list. By default the name entered when the custom field editor is created. | required | string |
single | Specifies if this editor will be listed in the editor list when the field is a single valued field. | Either single or multiple is required and set to true | Boolean |
multiple | Specifies if this editor will be listed in the editor list when the field is multivalued field. | Either single or multiple is required and set to true | Boolean |
handlesMultiple | Specifies if this editor can handle more than one value. | required | Boolean |
supportedDataTypes | List of data types for which this editor can be used. | required | Array of data types |
autoresize | Specifies whether or not to send resize notification to the content item form when this editor is resized. Custom editors are rendered inside an iframe in the content item form. When this property is set to true, the field editor SDK will notify the form to adjust the iframe size when the editor's size changes. | optional | Boolean |
validation | Specifies whether or not the value entered in this editor needs to be validated in the content item editor form. When set to true, the editor needs to register and provide a call back function to be called by the content item form for validation. | optional | Boolean |
useDefaultFormView | Specifies whether or not to use the system default form view when viewing the content item that has this editor. If this property is not present or is set to false, the view.html implementation will be used to render the view mode of the field. | optional | Boolean |
In addition to the above properties, you can also define settings that can be used to render the editor configuration view when this editor is selected while defining a content type. For example, if you are writing an editor to handle a phone number in your field and want to set up a few formats to pick during field definition time:
{
"type": "fieldeditor",
"name": "Phone Number",
"single": true,
"multiple": true,
"handlesMultiple": false,
"supportedDatatypes": ["text"],
"autoresize": true,
"useDefaultFormView": false,
"settings":[
{
"id": "mask",
"type": "list",
"name": "Phone number format",
"options": [
{
"label": "+1(999)-999-9999",
"value": "+1(999)-999-9999"
},
{
"label": "+44(999)-9999-9999",
"value": "+44(999)-9999-9999"
},
{
"label": "+49 999 99999999",
"value": "+49 999 99999999"
}
]
}
]
}
Note that settings in an array can have more than one type. Currently two types of settings are supported:
- text
- list
Text
- id: the field ID
- name: the field name
- type: the field type
For example:
{
"id":"min",
"name":"Minimum",
"type":"text"
}
would render an editor configuration view with a text field named
Minimum in the settings dialog with an ID of
min
If a you want to use a default value for the field as part of the settings, you can modify the settings:
{
"id":"oracle.cloud.content.defaultValue",
"type":"text"
}
where now the default value field is displayed.
List
For a list, in addition to id, type, and name, a list of options for display in the list also needs to be provided. For example, if you are writing an editor to handle a phone number in your field and want to set up a few formats to pick during field definition:
{
"type": "fieldeditor",
"name": "Phone Number",
"single": true,
"multiple": true,
"handlesMultiple": false,
"supportedDatatypes": ["text"],
"autoresize": true,
"useDefaultFormView": false,
"settings":[
{
"id": "mask",
"type": "list",
"name": "Phone number format",
"options": [
{
"label": "+1(999)-999-9999",
"value": "+1(999)-999-9999"
},
{
"label": "+44(999)-9999-9999",
"value": "+44(999)-9999-9999"
},
{
"label": "+49 999 99999999",
"value": "+49 999 99999999"
}
]
}
]
}