The Content Editor module generates forms for content editing from a JSON definition. This JSON definition is built from the node type definition (definitions.cnd
) and from the JSON files in the META-INF/jahia-content-editor-forms
folder.
The following diagram shows an example of how forms are generated for a custom module that is used to edit an event. The form is built from the definitions.cnd
file for Acme:event
and the jmix_title.json
and acme_event.json
overrides. The FormService contains logic that merges the definitions.cnd
file and the overrides. Finally, the Content Editor form is rendered for Jahia content editors through the Jahia GraphQL API.
The FormService merges the definition.cnd
file and JSON override files in the following way:
This example shows the JSON form definition for the jnt:news
node type.
"data":{
"forms":{
"createForm":{
"name":"jnt:news",
"displayName":"News entry",
"description":"",
"sections":[{
"name":"content",
"displayName":"Content",
"description":null,
"fieldSets":[{
"name":"jnt:news",
"displayName":"News entry",
"description":"",
"dynamic":false,
"activated":true,
"fields":[{
"name":"jcr:title",
"displayName":"News Title",
"description":"This is your news title<br/>It will be displayed as the header of your news.",
"errorMessage":"",
"mandatory":true,
"i18n":true,
...},
...],
...},...]
},...]
}
}
}
The form files located in META-INF/jahia-content-editor-forms/forms
have the following structure:
jnt:news
.
{
"name": ...,
"priority": ...,
"sections": [
{
...
}
]
}
When using static declaration of fieldsets, you can override existing properties declared in the definitions.cnd
file. However, you cannot use overrides to create a new field that is not declared in a JCR definition as this behaviour isn't supported by the product.
A fieldset is composed of a:
The following example shows the structure of definitions files.
{
"name": ...,
"rank": ...,
"priority": ...,
"dynamic": ...,
"removed": ...,
"activated": ...,
"fields": [
{
"name": ...,
"description": ...,
"requiredType":...,
"selectorType": ...,
"i18n": ...,
"readOnly": ...,
"multiple": ...,
"mandatory": ...,
"target": {
"sectionName":...,
"rank": ...
}
}
]
}
Now that you understand the Content Editor form structure and how forms are generated, you can learn how to customize Content Editor at Customizing Content Editor forms or go straight to the Examples of content definition JSON overrides. If you need background on Content Editor interface elements and layout, see Understanding Content Editor forms and fields.