The Link Builder editor allows the content administrator to specify a link to a static page, a single selected record, or a navigation state.
The Link Builder uses the Select Records dialog to enable the content administrator to browse to a single record or a particular navigation state in the data set (which may include search terms, dimension refinements, or a combination of both). Alternately, the Link Builder also supports entering an absolute URL to a static resource.
To add a Link Builder to a template:
In
typeInfo
, insert anItem
property namedlink
as in the following example:"typeInfo": { "link": {"@propertyType": "Item"} }
In defaultContentItem, insert a link class of
com.endeca.infront.cartridge.model.LinkBuilder
, as in the following example:"defaultContentItem": { "@name": "Media Banner", "imageAlt": "", "link": {"@class": "com.endeca.infront.cartridge.model.LinkBuilder"}, "media": {"@class": "com.endeca.infront.cartridge.model.MediaObject"} },
Insert a corresponding
editors/LinkBuilderEditor
element withineditors/DefaultEditorPanel
.Specify the
propertyName
attribute and any additional label attributes for the editor:{ "editor": "editors/LinkBuilderEditor", "propertyName": "link", "label": "${property.link.label}", "enabled": true }
The following shows an example of a template that includes a link builder editor:
{
"@description": "${template.description}",
"@group": "MainContent",
"ecr:createDate": "2016-09-12T17:33:57.427+05:30",
"@thumbnailUrl": "thumbnail.png",
"ecr:type": "template",
"defaultContentItem": {
"@name": "Media Banner",
"imageAlt": "",
"link": {"@class": "com.endeca.infront.cartridge.model.LinkBuilder"},
"media": {"@class": "com.endeca.infront.cartridge.model.MediaObject"}
},
"editorPanel": {
"editor": "editors/DefaultEditorPanel",
"children": [
<!-- additional elements omitted from this example -->
{
"editor": "editors/LinkBuilderEditor",
"propertyName": "link",
"label": "${property.link.label}",
"enabled": true
}
]
},
"typeInfo": {
"imageAlt": {"@propertyType": "String"},
"link": {"@propertyType": "Item"},
"media": {"@propertyType": "Item"}
}
}
The Link Builder must be configured with a path to a data service.
Below is the configuration for the Link Builder in the editor JSON file for the
Discover Electronics reference application, located at
<app
dir>\config\import\editors\LinkBuilderEditor\_.json
:
{ "ecr:type":"editor", "config":{ "resourcePath":"/configuration/tools/xmgr/services/endecaBrowserService.json" } }