Default component types

WebCmsModule contains a number of default component types, backed by a set of default WebCmsComponentModel implementations. You can easily define your own component types by extending one of these base types, see the chapter Defining component types.

The following component types are added with the default data:

Type key Description Base type 1 WebCmsComponentModel

proxy

A proxy for another component that will be rendered instead.

proxy

ProxyWebCmsComponentModel

placeholder

Represents a placeholder for content provided by code or templates.

placeholder

PlaceholderWebCmsComponentModel

container

Container of multiple ordered components. The user can add or remove child components to the container.

container

ContainerWebCmsComponentModel

fixed-container

Container of a fixed set of components. The user can not add or remove child components to the container.

fixed-container

ContainerWebCmsComponentModel

text-field

A single line of plain text.

plain-text

TextWebCmsComponentModel

plain-text

Plain text component.

plain-text

TextWebCmsComponentModel

rich-text

Rich text component - supporting HTML markup and default assets if enabled by other modules.

rich-text

TextWebCmsComponentModel

html

A snippet of HTML.

markup

TextWebCmsComponentModel

image

Represents a WebCmsImage asset.

image

ImageWebCmsComponentModel

1 The Base type is the value of the type attribute on the WebCmsComponentType. Every component type must have a unique type key, but several component types can have the same base type.

See WebCmsComponentUtils for some utility functions when working with components and component types.

WebCmsComponentModel implementations

All component models must extend WebCmsComponentModel. A number of default implementations is provided by the WebCmsModule. It is usually the WebCmsComponentType base type (type attribute) that will determine the WebCmsComponentModel that gets instantiated.

TextWebCmsComponentModel

Represents a text component that can be either plain text, rich text or markup. In all cases an optional profile is supported that can indicate the sub-types of content that are supported.

A TextWebCmsComponentModel is a large body of text (the content property) that should be escaped or not upon rendering. The other properties are mostly relevant for the administrative user interface.

TextWebCmsComponentModel content can contain content markers.

Base types

The following base types will create a TextWebCmsComponentModel:

  • plain-text: will escape its content when rendering

  • rich-text: unescaped content with a RTE in the administration UI

  • markup: unescaped content with a HTML editor in the administration UI

Component type attributes

TextWebCmsComponentModel implementations check extra WebCmsComponentType attributes to map their properties.

Attribute Description

multiLine

If set to false, the component will behave as a single line of text. In all other cases it will behave as a multi-line text component.

rows

Size indicator: number of rows the component should have by default. Only applicable in case of a multi-line component.

profile

Optionally specify an additional text profile this component should use. The text profile can for example be used to determine settings of the rich text editor.

ContainerWebCmsComponentModel

A ContainerWebCmsComponentModel represents an ordered collection of other components (the container members). By default a container simply renders its individual members in order.

Markup containers

Containers can optionally also support markup (determined by the supportsMarkup attribute on the actual WebCmsComponentType). If markup is set, it represents the rendering template for the container and members should be rendered using content markers.

Within container markup, component content markers can use the container scope to reference a member of the container itself.

Base types

The following base types will create a ContainerWebCmsComponentModel:

  • container: allows dynamic addition/removal of members

  • fixed-container: holds a fixed set of members (useful as a base type for custom components)

Component type attributes

ContainerWebCmsComponentModel implementations check extra WebCmsComponentType attributes to map their properties.

Attribute Description

supportsMarkup

If set to true then markup on the container will be used for rendering if there is markup set.

PlaceholderWebCmsComponentModel

A PlaceholderWebCmsComponentModel has only a single relevant property: the name of the placeholder whose content should be rendered. By default if no placeholder content is available, this component will render an empty string.

Base type: placeholder

ProxyWebCmsComponentModel

A ProxyWebCmsComponentModel holds a reference to another component (the proxy target) and renders that component instead. Use a ProxyWebCmsComponentModel if you want to add an already existing component as a member of a container.

Base type: proxy

ImageWebCmsComponentModel

An ImageWebCmsComponentModel holds a reference to a WebCmsImage asset. Default rendering of an ImageWebCmsComponentModel is not very useful and developers should provide their own rendering by either updating the WebCmsComponentType with a custom template or by providing the rendering infrastructure (see Thymeleaf rendering).

For the ImageWebCmsComponentModel to function, a valid WebCmsImageConnector bean should be present. See the chapter Image model for more information.