Boolean properties represent a true or false value and can be used to enable or disable features in your application.
To add a Boolean property to a template:
In
typeInfo
element, insert aBoolean
element inside a@propertyType
element."typeInfo": { "showMoreLink":{ "@propertyType":"Boolean" } }
Specify the default value for the property.
"defaultContentItem": { "showMoreLink":false },
Any value other than the string "
false
" (case insensitive) defaults to a value oftrue
.
The following example shows the configuration of a Boolean property:
{ "ecr:type":"template", "@group":"Navigation", "@description":"${template.description}", "@thumbnailUrl":"thumbnail.jpg", "typeInfo":{ "dimensionName":{ "@propertyType":"String" }, "dimensionId":{ "@propertyType":"String" }, "sort":{ "@propertyType":"String" }, "showMoreLink":{ "@propertyType":"Boolean" }, "moreLinkText":{ "@propertyType":"String" }, "lessLinkText":{ "@propertyType":"String" }, "numRefinements":{ "@propertyType":"String" }, "maxNumRefinements":{ "@propertyType":"String" }, "boostRefinements":{ "@propertyType":"List" }, "buryRefinements":{ "@propertyType":"List" } }, "defaultContentItem":{ "@name":"Dimension Navigation", "dimensionName":"", "dimensionId":"", "sort":"default", "showMoreLink":false, "moreLinkText":"Show More Refinements...", "lessLinkText":"Show Less Refinements...", "numRefinements":"10", "maxNumRefinements":"200", "boostRefinements":[ ], "buryRefinements":[ ] },
A Boolean editor provides a checkbox for Experience Manager users to specify the value of a Boolean property.
To add a Boolean editor:
Insert a
editors/BooleanEditor
element withineditors/DefaultEditorPanel
.Specify additional attributes for the editor:
Attribute Description propertyName
Required. The name
of the Boolean property that this editor is associated with. This property must be declared in the same template as the Boolean editor.enabled
If set to false
, the checkbox displays in Experience Manager but the value cannot be changed by the user. By default, checkboxes are enabled.
The following example illustrates a checkbox Boolean editor:
{
"ecr:type":"template",
"@group":"Navigation",
"@description":"${template.description}",
"@thumbnailUrl":"thumbnail.jpg",
"typeInfo":{
<!-- additional elements omitted from this example -->
"showMoreLink":{
"@propertyType":"Boolean"
},
<!-- additional elements omitted from this example -->
},
"defaultContentItem":{
"@name":"Dimension Navigation",
"dimensionName":"",
"dimensionId":"",
"sort":"default",
"showMoreLink":false,
"moreLinkText":"Show More Refinements...",
"lessLinkText":"Show Less Refinements...",
"numRefinements":"10",
"maxNumRefinements":"200",
"boostRefinements":[
],
"buryRefinements":[
]
},
"editorPanel": {
"editor": "editors/DefaultEditorPanel",
"children": [
<!-- additional elements omitted from this example -->
{
"editor":"editors/BooleanEditor",
"enabled":true,
"label":"${property.showMoreLink.label}",
"propertyName":"showMoreLink"
},
<!-- additional elements omitted from this example -->
}
}