A template defines the properties of a content item and also the interface that enables a content administrator to configure the properties.

You define properties within the typeInfo element in the template. For each property, you specify a name and a property type. You can optionally specify a default value for a property within the defaultContentItem element..

You associate editors with properties to enable the content administrator to configure their values within Experience Manager. Properties are generally primitive types such as Strings, Booleans, or Lists. Another type of property is a section, which allows content administrators to insert and configure another content item.

You can choose not to expose a particular property in Experience Manager and simply specify a default value to pass to the Assembler and ultimately to the client application. This is useful for values that do not need to be configured by the content administrator, but are needed by the Assembler for content processing or by the client application to determine how to render the content.

You can define the properties of a content item within the typeInfo element. You can define the default values for these properties in the defaultContentItem element.

Cartridge properties are typically used for one of the following purposes:

Each property must have a name that is unique within the template. If the property is to be passed through directly to the renderer, this can be any name that makes sense for your application. However, some properties are part of the configuration model for the cartridge. In this case the associated cartridge handler depends on the presence of specific properties in the template.

You specify the property type by adding an element of @propertyType in typeInfo.

The following example has three property elements nested within the Results List typeInfo item. The property elements are boostStrata, buryStrata, and sortOption.

"typeInfo": {
        "boostStrata": {"@propertyType": "List"},
        "buryStrata": {"@propertyType": "List"},
        "sortOption": {"@propertyType": "Item"}
    }

The following example lists the default values for the sortOption property in the Results List defaultContentItem item.

"defaultContentItem": {
        "sortOption": {
            "@class": "com.endeca.infront.navigation.model.SortOption",
            "label": "Most Sales",
            "sorts": [{
                "@class": "com.endeca.infront.navigation.model.SortSpec",
                "key": "product.analytics.total_sales",
                "descending": false
            }]
        }
    },

After you have defined the content properties in your template, you can define how those properties can be configured by the content administrator in Experience Manager.

You add content editors inside the editorPanel element in the template. The children editors under the "editor":"editors/DefaultEditorPanel" element let you specify individual property editors that display in Experience Manager and associate them with a particular property.

For example, this excerpt from a sample template defines a property named boostStrata:

 {
                "editor": "editors/BoostBuryRecordEditor",
                "buryProperty": "buryStrata",
                "label": "${property.boostBury.label}",
                "propertyName": "boostStrata"
            }

Editors are defined in templates with the editor namespace. By convention, the propertyName is a required attribute and specifies the property that this editor is associated with. The property must be defined in the contentItem part of the template, and must be of the appropriate type for that editor. If you define a content editor for a property that does not exist, or that is of the wrong type, a warning displays in Experience Manager when a content administrator attempts to configure the content.

Property editors do not have to be defined in the same order as the properties in the template. The "editor":"editors/DefaultEditorPanel" renders the editors in a vertical layout in Experience Manager, in the order in which you define them in the template. If you do not want a property to be exposed in the Experience Manager interface, do not define an editor associated with it.

It is possible to create more than one editor associated with the same property. However, be aware that all editors that you define in the template are displayed in Experience Manager, which may be confusing to the content administrator. When the value of a property is changed, any other editors associated with that property are instantly updated with the new value.


Copyright © Legal Notices