The Dynamic Slot editor enables the content administrator to configure a section of an application page at query time by specifying one or more folders from which to return content.
The editor has no associated template configuration, although it launches a configuration dialog in Experience Manager. When the content administrator edits the cartridge in Experience Manager, the editor queries the Endeca Configuration Repository for a list of folders. These results are refined based on the template group or template ID restrictions entered by the content administrator.
You should configure a separate cartridge template for each template group that requires dynamic slot functionality.
To create a cartridge template with a dynamic slot:
Insert a
typeInfo
that includes the following properties:For example:
"typeInfo": { "contentPaths": {"@propertyType": "List"}, "ruleLimit": {"@propertyType": "String"}, "templateIds": {"@propertyType": "List"}, "templateTypes": {"@propertyType": "List"} }
These properties are sent in as configuration to a
ContentSlotConfig
object that dynamically populates the page with a suitable content item. For more information, see About ContentInclude and ContentSlotConfig objects.Add any default values to the
defaultContentItem
.For example:
"defaultContentItem": { "@name": "Secondary Content Slot", "ruleLimit": "1", "templateTypes": ["SecondaryContent"] }
In the
EditorPanel
, insert aneditors/DynamicSlotEditor
element within aeditors/DefaultEditorPanel
:"editorPanel": { "editor": "editors/DefaultEditorPanel", "children": [{"editor": "editors/DynamicSlotEditor"}] }
Upload the template to your application:
Navigate to your
<app dir>\control
directory.For the Discover Electronics reference application, this is
C:\Endeca\apps\Discover\control
on Windows, or/usr/local/endeca/apps/discover/control
on UNIX.Run the
set_templates
batch or shell script.Note
You must configure a cartridge handler for your template in order to use it in Experience Manager.
The following shows the sample template in the Discover Electronics
application for a dynamic slot cartridge. The slot is restricted to cartridges
of the
SecondaryContent
group.
{ "@description": "${template.description}", "@group": "SecondaryContent", "ecr:createDate": "2016-09-12T17:33:56.623+05:30", "@thumbnailUrl": "thumbnail.png", "ecr:type": "template", "defaultContentItem": { "@name": "Secondary Content Slot", "ruleLimit": "1", "templateTypes": ["SecondaryContent"] }, "editorPanel": { "editor": "editors/DefaultEditorPanel", "children": [{"editor": "editors/DynamicSlotEditor"}] }, "typeInfo": { "contentPaths": {"@propertyType": "List"}, "ruleLimit": {"@propertyType": "String"}, "templateIds": {"@propertyType": "List"}, "templateTypes": {"@propertyType": "List"} } }
You must specify a cartridge handler for each cartridge template that you configure as a dynamic slot.
All dynamic slot cartridges can share the same cartridge handler, but each unique cartridge must be explicitly configured to do so.
As soon as you have created a cartridge template that uses a
dynamic slot, you must register a cartridge handler for that template. This
cartridge handler should inherit the
CartridgeHandler_ContentSlot
handler.
To specify a cartridge handler for a dynamic slot template:
Open the configuration file for your application framework.
In the Discover Electronics reference application, this is the Spring context configuration file located in
%ENDECA_TOOLS_ROOT%\reference\discover-electronics-authoring\WEB-INF\assembler-context.xml
.Configure a cartridge handler for your template that inherits or extends the
ContentSlotHandler
.In the Spring implementation of the Assembler, this consists of adding a new
CartridgeHandler
bean for your dynamic slot cartridge:This results in configuration similar to the following:
<bean id="CartridgeHandler_MyPageSlot" parent="CartridgeHandler_ContentSlot" scope="prototype"/>
Repeate as necessary for any other dynamic slot templates in your application.