This page describes definition properties and template definition properties of a
block, a component-like content element provided by the Content editor module.
A block is the smallest piece of content in an implementation of the Content editor, such as the Stories app. A block definition gives a block a name and specifies the content allowed to form a single block. A block template definition specifies which template should be used to render a block in an area or a page.
Block content is stored using the
mgnl:blockin the JCR. similar to the custom node type
mgnl:content, but it cannot be versioned on its own. Block content is usually grouped into block compositions (
mgnl:composition ), which are versionable.
You define blocks to add or modify content in the Stories app or in an implementation of the Content editor. To render the block content, you must then define a template definition and a script for the block. You can define them both using
If you want to define field labels and other i18n descriptors for the elements of your block, you can create the i18n file for the block(s) included in your module.
|i18n file (optional)|
<block-name> gives the block its name in the JCR.
<path> is arbitrary but would typically be
blocks for block template files.
See Module configuration - Location of configuration items for a broader explanation of the location of definition files.
The fully-qualified class name for the Java bean representing the definition of the block. Needs to be a subtype of
The default implementation of
For blocks wrapping one or multiple form fields, there is a built-in
optional ( A default value is already a part of the definition, so there's in fact no need to specify it in the definition YAML file.)
The fully-qualified class name for the Java bean representing the block. Needs to be a subtype of
The ID of the template definition in
required only for the
Defines what field types are available in the block.
optional, default is icon-help-mark
Defines the icon used by the Block chooser toolbar.
A custom i18n base name used by the
By default the block's name in the JCR is used.
An i18n label for the block, for example the value
Block template definition
You can use the following properties in a block template definition:
The renderer to be used.
Path to the template script in the
No dialog definition is required in the block template definition. Everything that is related to the content and the form of a block is defined in the block definition.
Block definitions provided
Magnolia provides the following definitions out-of-the-box.
Use this definition to configure the list of fields depending on your needs as explained in the properties table above.
Do not use the field type
info.magnolia.ui.form.field.definition.RichTextFieldDefinition on a FieldSetBlockDefinition, instead use the RichTextBlock (see below).
This is a block definition with a single field. Use this block when you need a rich text editor.
Example block definition: