Creating an editor for your smartlet

Release 1.4 - ...

Every smartlet should have an Editor item inside the Configuration/Editors folder. The Configure Smartlet dialog will render this item display a friendly editor to the user. If you need to display a different interface in different situations (multiple (sub-)smartlets within the same smartlet folder, different user roles, etc.) this single Editor item should implement logic to change its appearance (e.g. by redirecting to a different item).

Displaying the editor can be as simple as:

Smartsite SXML CopyCode image Copy Code
<se:smartleteditor />

The SmartletEditor macro reads the editable properties from the smartlet public interface definition. These will be displayed on the tab "Smartlet Properties". Extra properties that will be included for all smartlets can be defined in the translation SmartletNamedArgs(). This translation returns a data table with the following columns:

Smartsite SXML CopyCode image Copy Code
<se:row>
 <se:col name="Name" datatype="string">box</se:col>
 <se:col name="Type" datatype="string">String</se:col>
 <se:col name="DefaultValue" datatype="string">smartinstant</se:col>
 <se:col name="Rem" datatype="string">The type of box that the Smartlet will appear in.</se:col>
 <se:col name="Category" datatype="string">Box Properties</se:col>
</se:row>

The column "Category" determines the tab on which the property is displayed.

A control for each property is displayed using the formatting defined in the translation SmartletEditorDefaultTypes(). Note that the <se:rowformat> elements are placed inside a CDATA block, to suspend execution. Controls that are common for more than one smartlet can be added here. To created specific controls in a smartleteditor, use the RowFormats collection.

Use the expression attribute to match any property or group of properties. The RowFormats parameter is inserted at the top of the se:format definition, so that the controls defined there override rows defined in the DefaultTypes.

Smartsite iXperion 1.4

Smartsite iXperion 1.4 introduces new features in the Smartlet Editor.

Public interface properties

The only way to influence the editor's default behaviour from the Smartlet definition was to set the editable property to true or false. Now you can set caption to override the caption displayed by the editor and category to determine the tabstrip on which the field is placed. If no caption is specified, the property name is used. The default for category is "Smartlet Properties".

The editable attribute now has three possible values:

  • false (default)
    The property doesn't show up in the SmartletEditor.
  • true
    The property is visible in the editor for all users (unless its value is set by a preset).
  • advanced
    The property is only visible for users who have the privilege Advanced Smartlet Editor.

Existing editor behaviour is unaffected.

Filtering

The way a control renders can be influenced by its filter property. Filters can only be defined within a Smartlet Preset. There is no default handling for filter, it's up to the designer of the Smartlet editor to interpret the filter and act accordingly.

Preview CSS

The Smartlet Editor can now add selected CSS includes to the smartlet preview. These includes are configured in the Page buffer "smlConfig_EditorPreviewCSS". This buffer contains a comma-separated list of Locators. Include it in the SmartletConfig() translation to have CSS in every preview:

Smartsite SXML CopyCode image Copy Code
{buffer.set(smlConfig_EditorPreviewCSS, page, "CSS_LAYOUT,CSS_CONTENT")}