Developing a custom content editor app

This page describes how to develop a custom content editor app based on the Magnolia Content editor.

Compatibility note

Magnolia 6 UI framework is implemented in version 2 of the Content Editor module. Custom content editor and block definitions created in the Magnolia 5 UI framework are not compatible with this version of the module and must be migrated.

If you wish to keep using the existing 5 UI block and custom content editor definitions, you must install version 1.3.9 of the Content Editor module and use them with this version.

Before you start

This section mentions what you should be aware of before creating an implementation of the content editor.

Understanding the content model: block, composition

A block is a well-defined page section which, together with other blocks and additional meta information, can form a single content composition.

In the context of the content editor app, each item (e.g. a story in the stories-app) is a composition of N blocks of editable content, such as headings and paragraphs, complemented by meta information such as the required fields for the lead and title of the story:

A compostiion example viewed as JCR nodes

Required node types

The content editor UI expects nodes of the type mgnl:block, mgnl:composition and mgnl:collection. These node types are defined in the file content-editor-nodetypes.cnd which resides in the magnolia-content-editor submodule.

Hoewever, registration of these node types is handled by the stories-app via the XML-based module descriptor.

Dependencies on the content editor modules

In any case, your implementation of the content editor depends on the following modules:

  • magnolia-content-editor

  • magnolia-block-api

  • magnolia-block-templating

Besides the requirement for these base modules, you must also ensure that the system registers the required node types.

If your custom content editor is created with a light module, your bundle must contain the stories-app module. If created with a Magnolia Maven module, you can register the node types within your custom module.

If you are using a preconfigured DX Core webapp or bundle (see the list of preconfigured Magnolia bundles), it already contains the stories-app and all the required modules.


To store new content items with your custom content editor, you can use

  • the stories workspace provided by the stories-app module,

  • or a custom workspace defined by your custom module.

Multilingual content

The Content editor and the Stories app don’t yet support multi-language content.

Defining a custom content editor app

Developing a custom content editor app is similar to creating any other 6 UI app because it is based on the app class.

You can build your custom content editor app within a light module.

Here is an overview how to define a content editor app:

  • Create a YAML app descriptor with its subapps.

  • The browser subapp is just a browser descriptor from the UI (info.magnolia.ui.contentapp.configuration.BrowserDescriptor).

  • The detail subapp should extend

Creating the descriptor and subapps

Create a YAML app descriptor.

Typically, you need at least the following two subapps:

  • The browser subapp. Use a regular browser descriptor class info.magnolia.ui.contentapp.configuration.BrowserDescriptor.

  • The editor subapp. Use, which extends

    Action definitions
            class: info.magnolia.editor.action.CloseContentEditorActionDefinition
            class: info.magnolia.editor.action.SaveContentActionDefinition
            class: info.magnolia.editor.action.SavePublishContentActionDefinition

Using mgnl:composition in the app descriptor

Set the mgnl:composition node type:

  • As one of the allowed node types of your app:

      $type: jcrDatasource
      workspace: <workspace-name>
        - mgnl:composition
        - mgnl:folder

    (Instead of <workspace-name>, use stories, articles or the name of your custom workspace.)

  • As the primary node in the dropConstraint in a content view of the browser subapp:

        class: info.magnolia.ui.contentapp.configuration.BrowserDescriptor
            - name: tree
              $type: treeView
                $type: jcrDropConstraint
                primaryNodeType: mgnl:composition
                - name: jcrName
                  $type: jcrTitleColumn
                    mgnl:folder: icon-folder
  • As node types for the datasource and item provider in the detail subapp:

        class: info.magnolia.ui.contentapp.detail.DetailDescriptor
          $type: jcrDatasource
          workspace: stories
            - mgnl:composition
            - mgnl:folder
          $type: jcrNodeFromLocationProvider
          nodeType: mgnl:composition

Creating a composition of fields and blocks

You can use a combination of the following field types to create a composition of editable elements for your editor form:

  • Expanding text field

    • type alias: expandingTextField

    • class:

  • Collapsible composite field

    • type alias: collapsibleCompositeField

    • class:

  • Multi block (a set of blocks). The developer of the editor defines what block types will be available to the editor. The actual number of blocks added and their mutual position is determined by the editor.

    • type alias: multiJcrBlock

    • class: info.magnolia.editor.block.jcr.MultiJcrBlockDefinition

Example collection

The following definition creates a collection consisting of four editable elements:

  • A two-row title field (title).

  • A composite field (datesAndSlug) for:

    • Story date.

    • URL slug of the story.

  • A multi block (custom) that can hold multiple instances of block types text and image.

          $type: expandingTextField
          label: Story title
          rows: 2
          $type: collapsibleCompositeField
          label: Date & Slug
          collapsed: false
            $type: currentItemProvider
              $type: dateField
              label: Story created on
              defaultValue: now
              $type: slugField
              label: URL slug
              placeholder: Add a URL slug ...
          $type: multiJcrBlock
            - text
            - image
          initialBlock: text
          defaultBlock: image
            $type: currentItemProvider
Rendered as

A rendering of a content editor composition.

The multi block

An editor node defined using multiJcrBlock creates a block set and specifies what block types are allowed in it and their appearance.

The Content Editor module comes with four predefined types of block you can use in your editor:

  • text

  • image

  • video

  • externalLink

Multi block properties


Specifies what will be created as the initial, automatically added block when creating new content (or when no block is available). Example:

initialBlock: text

Defines the block type which will be pre-selected in the block picker dialog. Example:

defaultBlock: image

Block picker dialog


Defines the app(s) whose resources you can link to from the text block. Example:

  - pages
  - assets
  - contacts