This documentation is still in progress. We are working hard to update all our screenshots to the new Magnolia 6 style. Please bear with us.

Page tree
Skip to end of metadata
Go to start of metadata

The Content editor is a special type of subapp designed to handle content in flexible ways. You need the Content Editor module to use this subapp.

Its definition class ContentEditorSubAppDescriptor extends ContentSubAppDescriptor , it therefore inherits all the properties from the Subapp descriptor. Additionally, ContentEditorSubApp defines the content of its subapp through the ContentDefinition property.

ContentEditorSubAppDescriptor

Here is a simplified example of a content editor subapp definition:

articles.yaml
subApps:
  editor:
    class: info.magnolia.editor.app.ContentEditorSubAppDescriptor
    contentConnector: <simplified>
    actions: <simplified>
    contentDefinition: <simplified>
Node nameValue

 editor


 class

info.magnolia.editor.app.ContentEditorSubAppDescriptor

 contentConnector


 actions


 contentDefinition


Note that the above definition is incomplete and would not work properly. See below for a complete app definition.

Properties:

<subapp-name>

required

Subapp node name. This is the internal ID of the subapp. In the above example it is editor .

class

required

Must be info.magnolia.editor.app.ContentEditorSubAppDescriptor or a subclass.

contentConnector

required

The content connector specifies the data source, see content connector definition for further details.

actions

required

The actions, see Action definition.

contentDefinition

required

A definition of content consisting of outline fields and a list of blocks (see below).

ContentDefinition

ContentDefinition is a property of the ContentEditorSubAppDescriptor which defines the outline fields and a list of blocks to be used by the subapp. Its definition class is ContentDefinition

Example:

editor.yaml
contentDefinition:
  outlineFields: <simplified>
  blocks: 
    - text
    - image
    - video
    - externalLink
  initialBlock: text
  defaultBlock: image
Node nameValue

 contentDefinition


 outlineFields


 blocks


 0

text

 1

image

 2

video

 3

externalLink

 initialBlock

text

 defaultBlock

image

Properties:

outlineFields

required

A list of FieldDefinition items. See Field definition for further information about how to configure a field.

The outline represents the structured part of the content item to be edited, such as the title, author, creation date and so on.

blocks

required

A list of blocks.

<block–name>

required

Specify the block by its name. You can only use the blocks which are known to the BlockRegistry .

initialBlock

required

The name of the block that will be created as the initial block when creating a new content item.

defaultBlock

required

The name of the block which will be selected by BlockPickerField .


A complete example

Below is a complete example of an app which contains one subapp of the ContentEditorSubAppDescriptor type. The content editor subapp starts at line 359.

article-editor/apps/editor.yaml
icon: icon-documents-app
appClass: info.magnolia.ui.contentapp.ContentApp
class: info.magnolia.ui.contentapp.ContentAppDescriptor
theme: content-editor
subApps:
  browser:
    subAppClass: info.magnolia.ui.contentapp.browser.BrowserSubApp
    class: info.magnolia.ui.contentapp.browser.BrowserSubAppDescriptor
    closable: false
    contentConnector:
      includeProperties: false
      workspace: articles
      rootPath: /
      defaultOrder: jcrName
      nodeTypes:
        - icon: icon-node-content
          name: mgnl:composition
          strict: true
        - icon: icon-folder-l
          name: mgnl:folder
          strict: true
    imageProvider:
      originalImageNodeName: photo
      imageProviderClass: info.magnolia.ui.imageprovider.DefaultImageProvider
      class: info.magnolia.ui.imageprovider.definition.ConfiguredImageProviderDefinition
    workbench:
      dropConstraintClass: info.magnolia.ui.workbench.tree.drop.AlwaysTrueDropConstraint
      editable: true
      contentViews:
        - name: tree
          class: info.magnolia.ui.workbench.tree.TreePresenterDefinition
          columns: &defaultColumns
            - name: jcrName
              width: 0.6
              sortable: true
              propertyName: jcrName
              class: info.magnolia.ui.workbench.column.definition.PropertyColumnDefinition
            - name: author
              width: 0.2
              sortable: true
              propertyName: author
              class: info.magnolia.ui.workbench.column.definition.PropertyColumnDefinition
            - name: moddate
              width: 0.1
              sortable: true
              displayInChooseDialog: false
              formatterClass: info.magnolia.ui.workbench.column.DateColumnFormatter
              propertyName: mgnl:lastModified
              class: info.magnolia.ui.workbench.column.definition.MetaDataColumnDefinition
            - name: status
              width: 0.1
              sortable: true
              displayInChooseDialog: false
              formatterClass: info.magnolia.ui.workbench.column.StatusColumnFormatter
              class: info.magnolia.ui.workbench.column.definition.StatusColumnDefinition
        - name: list
          class: info.magnolia.ui.workbench.list.ListPresenterDefinition
          columns: *defaultColumns
        - name: search
          class: info.magnolia.ui.workbench.search.SearchPresenterDefinition
          columns: *defaultColumns
    actions:
      addFolder:
        icon: icon-add-folder
        class: info.magnolia.ui.framework.action.AddFolderActionDefinition
        availability:
          writePermissionRequired: true
          root: true
          nodeTypes:
            folder: mgnl:folder
          rules:
            - name: IsNotDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule
      editFolder:
        dialogName: ui-framework:folder
        icon: icon-edit
        class: info.magnolia.ui.framework.action.OpenEditDialogActionDefinition
        availability:
          root: true
          writePermissionRequired: true
          nodeTypes:
            folder: mgnl:folder
          rules:
            - name: IsNotDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule
      addArticle:
        subAppId: editor
        icon: icon-add-item
        nodeType: mgnl:composition
        appName: articles
        class: info.magnolia.ui.contentapp.detail.action.CreateItemActionDefinition
        availability:
          writePermissionRequired: true
          root: true
          nodeTypes:
            folder: mgnl:folder
          rules:
            - name: IsNotDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule
      editArticle:
        subAppId: editor
        icon: icon-edit
        appName: articles
        class: info.magnolia.ui.contentapp.detail.action.EditItemActionDefinition
        availability:
          writePermissionRequired: true
          nodeTypes:
            article: mgnl:composition
          rules:
            - name: IsNotDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule
      renameArticle:
        icon: icon-edit
        dialogName: ui-framework:rename
        class: info.magnolia.ui.framework.action.OpenEditDialogActionDefinition
        availability:
          writePermissionRequired: true
          nodeTypes:
            article: mgnl:composition
          rules:
            - name: IsNotDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule
      delete:
        asynchronous: true
        command: markAsDeleted
        icon: icon-delete
        class: info.magnolia.ui.framework.action.MarkNodeAsDeletedActionDefinition
        availability:
          writePermissionRequired: true
          rules:
            - name: IsNotDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule
      activate:
        command: activate
        icon: icon-publish
        catalog: versioned
        class: info.magnolia.ui.framework.action.ActivationActionDefinition
        availability:
          writePermissionRequired: true
      activateRecursive:
        catalog: versioned
        command: activate
        icon: icon-publish-incl-sub
        recursive: true
        class: info.magnolia.ui.framework.action.ActivationActionDefinition
        availability:
          writePermissionRequired: true
          rules:
            - name: IsNotDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule
      deactivate:
        catalog: versioned
        command: deactivate
        icon: icon-unpublish
        class: info.magnolia.ui.framework.action.ActivationActionDefinition
        availability:
          writePermissionRequired: true
          rules:
            - name: IsNotDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule
      export:
        command: export
        icon: icon-export
        class: info.magnolia.ui.framework.action.ExportActionDefinition
        availability:
          rules:
            - name: IsNotDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule
      import:
        dialogName: ui-admincentral:import
        icon: icon-import
        class: info.magnolia.ui.framework.action.OpenCreateDialogActionDefinition
        availability:
          writePermissionRequired: true
          root: true
          rules:
            - name: IsNotDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule
      restorePreviousVersion:
        icon: icon-undo
        class: info.magnolia.ui.contentapp.detail.action.RestorePreviousVersionActionDefinition
        availability:
          writePermissionRequired: true
          rules:
            - name: IsDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsDeletedRule
      activateDeleted:
        catalog: versioned
        command: activate
        icon: icon-publish
        class: info.magnolia.ui.framework.action.ActivationActionDefinition
        availability:
          writePermissionRequired: true
          rules:
            - name: IsDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsDeletedRule
      confirmDeleteArticle:
        successActionName: delete
        icon: icon-delete
        class: info.magnolia.ui.framework.action.ConfirmationActionDefinition
        availability:
          multiple: true
          writePermissionRequired: true
          rules:
            - name: IsNotDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule
      confirmDeleteFolder:
        icon: icon-delete
        successActionName: delete
        class: info.magnolia.ui.framework.action.ConfirmationActionDefinition
        availability:
          multiple: true
          writePermissionRequired: true
          rules:
            - name: IsNotDeletedRule
              implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule
      showVersions:
        icon: icon-show-versions
        class: info.magnolia.ui.contentapp.browser.action.ShowVersionsActionDefinition
        availability:
          rules:
            - name: HasVersionsRule
              implementationClass: info.magnolia.ui.framework.availability.HasVersionsRule
      restoreVersion:
        icon: icon-retrieve-versions
        class: info.magnolia.ui.contentapp.browser.action.RestoreVersionActionDefinition
        availability:
          writePermissionRequired: true
          rules:
            - name: HasVersionsRule
              implementationClass: info.magnolia.ui.framework.availability.HasVersionsRule
    actionbar:
      defaultAction: editArticle
      sections:
        - name: root
          availability:
            nodes: false
            root: true
          groups:
            - name: addActions
              items:
                - name: addArticle
                - name: addFolder
            - name: editActions
              items:
                - name: editArticle
            - name: publishingActions
              items:
                - name: activate
                - name: activateRecursive
                - name: deactivate
            - name: eximActions
              items:
                - name: export
                - name: import
        - name: deletedArticle
          availability:
            nodeTypes:
              article: mgnl:composition
            rules:
              - name: IsDeletedRule
                implementationClass: info.magnolia.ui.framework.availability.IsDeletedRule
          groups:
            - name: addActions
              items:
                - name: addArticle
                - name: addFolder
            - name: editActions
              items:
                - name: editArticle
                - name: renameArticle
                - name: confirmDeleteArticle
            - name: publishingActions
              items:
                - name: activateDeleted
                - name: deactivate
            - name: eximActions
              items:
                - name: export
            - name: deletedActions
              items:
                - name: restorePreviousVersion
        - name: deletedFolder
          availability:
            nodeTypes:
              folder: mgnl:folder
            rules:
              - name: IsDeletedRule
                implementationClass: info.magnolia.ui.framework.availability.IsDeletedRule
          groups:
            - name: addActions
              items:
                - name: addArticle
                - name: addFolder
            - name: editActions
              items:
                - name: editFolder
                - name: confirmDeleteFolder
            - name: publishingActions
              items:
                - name: activateDeleted
                - name: deactivate
            - name: eximActions
              items:
                - name: export
            - name: deletedActions
              items:
                - name: restorePreviousVersion
        - name: folder
          availability:
            nodeTypes:
              folder: mgnl:folder
          groups:
            - name: addActions
              items:
                - name: addArticle
                - name: addFolder
            - name: editActions
              items:
                - name: editFolder
                - name: confirmDeleteFolder
            - name: publishingActions
              items:
                - name: activate
                - name: activateRecursive
                - name: deactivate
            - name: eximActions
              items:
                - name: export
                - name: import
        - name: article
          availability:
            nodeTypes:
              article: mgnl:composition
          groups:
            - name: addActions
              items:
                - name: addArticle
                - name: addFolder
            - name: editActions
              items:
                - name: editArticle
                - name: renameArticle
                - name: confirmDeleteArticle
            - name: publishingActions
              items:
                - name: activate
                - name: activateRecursive
                - name: deactivate
            - name: eximActions
              items:
                - name: export
                - name: import
            - name: versionActions
              items:
                # disabled - doesn't work at the moment
                # - name: showVersions
                - name: restoreVersion
  editor:
    class: info.magnolia.editor.app.ContentEditorSubAppDescriptor
    actions:
      close:
        class: info.magnolia.editor.action.CloseContentEditorActionDefinition
      save:
        class: info.magnolia.editor.action.SaveContentActionDefinition
      saveAndPublish:
        class: info.magnolia.editor.action.SaveContentActionDefinition
        onSuccessAction:
          class: info.magnolia.ui.framework.action.ActivationActionDefinition
          command: activate
    contentConnector:
      workspace: articles
      nodeTypes:
        - icon: icon-node-content
          name: mgnl:composition
          strict: true
        - icon: icon-folder-l
          name: mgnl:folder
          strict: true
    contentDefinition:
      outlineFields:
        title:
          class: info.magnolia.editor.app.field.ExpandingTextFieldDefinition
          required: true
          styleName: title
        lead:
          class: info.magnolia.editor.app.field.ExpandingTextFieldDefinition
          #This currently does not function due to the bug in ExpandingTextField
          rows: 3
          required: true
          styleName: lead-text
        leadImage:
          class: info.magnolia.editor.app.field.CollapsibleCompositeFieldDefinition
          fields:
            image:
              class: info.magnolia.editor.app.field.ExpandingLinkFieldDefinition
              buttonSelectNewLabel: browse
              buttonSelectOtherLabel: browse
              targetWorkspace: dam
              appName: assets
              identifierToPathConverter:
                class: info.magnolia.dam.app.assets.field.translator.AssetCompositeIdKeyTranslator
              contentPreviewDefinition:
                contentPreviewClass: info.magnolia.dam.app.ui.field.DamFilePreviewComponent
            imageCaption:
              class: info.magnolia.ui.form.field.definition.TextFieldDefinition
            imageAltText:
              class: info.magnolia.ui.form.field.definition.TextFieldDefinition
            imageCredit:
              class: info.magnolia.ui.form.field.definition.TextFieldDefinition
        publicationDate:
          class: info.magnolia.editor.app.field.CollapsibleCompositeFieldDefinition
          fields:
            created:
              class: info.magnolia.ui.form.field.definition.DateFieldDefinition
              time: true
              required: true
            updated:
              class: info.magnolia.ui.form.field.definition.DateFieldDefinition
              time: true
        authorInfo:
          class: info.magnolia.editor.app.field.CollapsibleCompositeFieldDefinition
          fields:
            author:
              class: info.magnolia.ui.form.field.definition.TextFieldDefinition
            location:
              class: info.magnolia.ui.form.field.definition.TextFieldDefinition
            jcrName:
              class: info.magnolia.ui.form.field.definition.TextFieldDefinition
              required: true
      blocks:
        - text
        - image
        - video
        - externalLink
      initialBlock: text
      defaultBlock: image
      linkableApps:
        - pages
        - assets