String properties are very flexible and can be used to specify information such as text to display on a page, URLs for banner images, or meta keywords for search engine optimization.
To add a string property to a template:
The following example shows a variety of string properties:
{
"@description": "${template.description}",
"@group": "Navigation",
"ecr:createDate": "2016-09-12T17:33:58.404+05:30",
"@thumbnailUrl": "thumbnail.jpg",
"ecr:type": "template",
"defaultContentItem": {
"lessLinkText": "Show Less Refinements...",
"numRefinements": "10",
"@name": "Dimension Navigation",
"dimensionId": "",
"moreLinkText": "Show More Refinements...",
"maxNumRefinements": "200",
"sort": "default",
"showMoreLink": false,
"dimensionName": ""
},
<!-- additional elements omitted from this example -->
"typeInfo": {
"boostRefinements": {"@propertyType": "List"},
"buryRefinements": {"@propertyType": "List"},
"dimensionId": {"@propertyType": "String"},
"dimensionName": {"@propertyType": "String"},
"lessLinkText": {"@propertyType": "String"},
"maxNumRefinements": {"@propertyType": "String"},
"moreLinkText": {"@propertyType": "String"},
"numRefinements": {"@propertyType": "String"},
"showMoreLink": {"@propertyType": "Boolean"},
"sort": {"@propertyType": "String"}
}
}
You add a string editor to enable configuration of string properties. The string editor displays in the Experience Manager interface as a text field or text area depending on the configuration.
String editors enable content administrators to supply arbitrary values for a string property. If you want to constrain the input to a specific enumeration of values, use a choice editor.
To add a string editor to a template:
Insert an
editors/StringEditorelement withineditors/DefaultEditorPanel.Specify label attributes and additional attributes for the editor:
Attribute Description propertyNameRequired. The nameof the string property that this editor is associated with. This property must be declared in the same template as the string editor.labelThe label for the editor. enabledIf set to false, this attribute makes the property read-only so that the value of the property displays in the Content Details Panel in Experience Manager, but cannot be edited. Set this tofalseonly if you specify a default value in the definition of the string property. Editors are enabled by default.
The following example shows a variety of editing options for string properties:
{
"@description": "${template.description}",
"@group": "Navigation",
"ecr:createDate": "2016-09-12T17:33:58.404+05:30",
"@thumbnailUrl": "thumbnail.jpg",
"ecr:type": "template",
"defaultContentItem": {
"lessLinkText": "Show Less Refinements...",
"numRefinements": "10",
"@name": "Dimension Navigation",
"dimensionId": "",
"moreLinkText": "Show More Refinements...",
"maxNumRefinements": "200",
"sort": "default",
"showMoreLink": false,
"dimensionName": ""
},
"editorPanel": {
"editor": "editors/DefaultEditorPanel",
"children": [
<!-- additional elements omitted from this example -->
{
"editor": "editors/StringEditor",
"propertyName": "moreLinkText",
"label": "${property.moreLinkText.label}",
"enabled": true
},
{
"editor": "editors/StringEditor",
"propertyName": "lessLinkText",
"label": "${property.lessLinkText.label}",
"enabled": true
}
]
<!-- additional elements omitted from this example -->
}
"typeInfo": {
"boostRefinements": {"@propertyType": "List"},
"buryRefinements": {"@propertyType": "List"},
"dimensionId": {"@propertyType": "String"},
"dimensionName": {"@propertyType": "String"},
"lessLinkText": {"@propertyType": "String"},
"maxNumRefinements": {"@propertyType": "String"},
"moreLinkText": {"@propertyType": "String"},
"numRefinements": {"@propertyType": "String"},
"showMoreLink": {"@propertyType": "Boolean"},
"sort": {"@propertyType": "String"}
}
}
Note
Neither Experience Manager nor the Assembler applies HTML escaping to strings. This enables content administrators to specify HTML formatted text in Experience Manager and have it rendered appropriately. If you intend to treat a string property as plain text, be sure to add HTML escaping to your application logic in order to avoid invalid characters and non-standards-compliant HTML.
A choice editor enables the user to select from predefined string values for a property that are presented in a drop-down list. Choice editors affect the value of a string property.
To add a choice editor:
Insert an
editors/ChoiceEditorelement withineditors/DefaultEditorPanel.Specify additional attributes for the editor:
Attribute Description propertyNameRequired. The
nameof the string property that this editor is associated with. This property must be declared in the same template as the choice editor.editableIf set to
true, this attribute allows Experience Manager users to specify custom string values. By default, choice editors are not editable.enabledIf set to
false, the choice editor displays in Experience Manager but the value cannot be changed by the user. By default, choice editors are enabled.promptSpecifies a custom prompt. The default prompt is an empty string. It is enabled only when editable is set to
true.tooltipIf present, specifies optional help text to display in a tool tip window. The default behavior is no tool tip.
widthThe width, in pixels, of the choice editor. By default, the width of the editor adjusts to fit the longest choice in the editor. Use this attribute if you want to set a fixed width for the editor.
Insert an
choiceselement within the.editors/ChoiceEditorelementSpecify one or more menu options for the choice editor by adding elements that takes the following attributes:
Attribute Description valueRequired. The string value to assign to the associated property if this choice is selected.
labelThis attribute allows you to specify a more descriptive label for this option in the drop down list. If no label is specified, the
valueis used by default. You must either specify alabelfor all of the choices or none of them. You cannot have labels for some choices and not others.Note
If you choose to make a choice editor editable (so that users can enter arbitrary strings), you should not use the
labelattribute for choices. Instead, the choice editor should display the raw value of the string so that users entering custom values can see the expected format of the string property.Optionally, set a default value in the corresponding
defaultContentItemproperty.For example,:
"defaultContentItem": { "sort": "default",Note
Ensure that the default value for the property is one of the options defined for the choice editor in a element.
The following example shows a choice editor configured with a default value.
{
"@description": "${template.description}",
"@group": "Navigation",
"ecr:createDate": "2016-09-12T17:33:58.404+05:30",
"@thumbnailUrl": "thumbnail.jpg",
"ecr:type": "template",
"defaultContentItem": {
"lessLinkText": "Show Less Refinements...",
"numRefinements": "10",
"@name": "Dimension Navigation",
"dimensionId": "",
"moreLinkText": "Show More Refinements...",
"maxNumRefinements": "200",
"sort": "default",
"showMoreLink": false,
"dimensionName": ""
},
"editorPanel": {
"editor": "editors/DefaultEditorPanel",
"children": [
<!-- additional elements omitted from this example -->
{
"editor": "editors/ChoiceEditor",
"propertyName": "sort",
"label": "${property.sort.label}",
"choices": [
{
"label": "${property.sort.default.label}",
"value": "default"
},
{
"label": "${property.sort.static.label}",
"value": "static"
},
{
"label": "${property.sort.dynRank.label}",
"value": "dynRank"
}
]
},
]
<!-- additional elements omitted from this example -->
}
"typeInfo": {
"boostRefinements": {"@propertyType": "List"},
"buryRefinements": {"@propertyType": "List"},
"dimensionId": {"@propertyType": "String"},
"dimensionName": {"@propertyType": "String"},
"lessLinkText": {"@propertyType": "String"},
"maxNumRefinements": {"@propertyType": "String"},
"moreLinkText": {"@propertyType": "String"},
"numRefinements": {"@propertyType": "String"},
"showMoreLink": {"@propertyType": "Boolean"},
"sort": {"@propertyType": "String"}
}
}

