Configuring Content Component Editors
You configure the content component editors the same way you would configure other UI components in the Cockpit Framework.
This document provides a high-level description of how to create and use UI configurations. For a detailed description of creating and using UI configurations, see Configuration of the Cockpit UI.
To configure a content component editor, do the following:
-
Create an XML file that includes the cockpit velocity template.
- For details on the contents of the XML file, see the XML Syntax section.
- For details on including the cockpit velocity template, see the Cockpit Velocity Template Syntax section.
-
Add the configuration to the platform; for details, see Importing Cockpit Configuration.
Creating Your Own Configuration
As described in the Configuration of the Cockpit UI, there are several properties that you must set when creating your own configuration. The following table describes the properties and values you must create when creating your own content component editor:
| Property | Value |
|---|---|
| code | contentEditor |
| objectTemplateCode | The object template to which the configuration should apply, for example: ParagraphElement. |
| principal | This property is not specified for content element editors because they apply to all users. |
| media | The XML configuration file itself. For detailed information, see the XML Configuration File section. |
| factoryBean | contentEditorConfigurationFactory |
Once you have created the configuration, you must import it into the platform. For details, see Importing Cockpit Configuration.
XML Configuration File
Similar to all UI component configurations, you configure the content component editor using XML files. Use the content-editor.xsd schema.
Sample XML Configuration File
<content-editor hideEmpty="true" hideReadOnly="true" groupCollections="false">
<template>
<![CDATA[
<table width="100%" style="margin:0;padding:0">
<tbody>
<tr><td><b>$label</b></td></tr>
<tr><td><cockpit code="property" value="CMSItem.name"/></td></tr>
<tr><td><cockpit code="general"/></td></tr>
<tr><td><cockpit code="list"/></td></tr>
</tbody>
</table>
]]>
</template>
<custom-editors>
<property qualifier="paragraphelement.content" editorCode="wysiwyg"/>
</custom-editors>
</content-editor>
XML Syntax
The XML syntax is as follows:
- content-editor: The root element
- @hideEmpty: If true, the general section will be hidden if it contains no attributes. The default value is true.
- @hideReadOnly: If true, only attributes which the user can edit are shown. The default value is true
- @groupCollections: If true, reference collection items are grouped together. The default value is true
- template: The Cockpit Velocity Template. For more information, see the Cockpit Velocity Template Syntax section below.
- custom-editors: The custom attribute editors to be used.
- property: The property for which a custom editor is to be used
- @qualifier: The qualifier of the property
- @editorCode: The name of the editor to be used
- @visible: If true, the editor is displayed. The default value is true.
- parameter: Custom editor parameters.
- name: Name of the parameter.
- value: Value of the parameter.
- property: The property for which a custom editor is to be used
Cockpit Velocity Template Syntax
The Cockpit Velocity Template can be any normal XHTML snippet. You can also use special tags and variables to inject content. The following tags and variables are supported in the template:
- $label: Variable containing the name of the content element that is currently being edited.
- <cockpit code="xyz" value="ijk"/>: Special Cockpit tag used to inject cockpit components.
- @code: The code attribute specifies what is to be injected. The possible code values are:
- general: Injects a General section, which contains all the content element's editor properties.
- list: Injects a list containing all item references that are not null. Each reference is displayed in its own section.
- property: Injects a property editor for the property specified in the value attribute
- @value: The value to be passed to the component injector. It is nly used when injecting a property. The following code excerpt provides an example:
<cockpit code="property" value="CMSItem.name"/>
- @code: The code attribute specifies what is to be injected. The possible code values are: