Enabling workflow in content apps

The Workflow module provides a four-eye content approval workflow preconfigured in the Pages app. It’s possible, however, for any content app to have a workflow attached to it. If the app already exists, a decoration file can be used. For a custom content app, you can configure the workflow directly in the app descriptor.

Existing content apps

With out-of-the-box apps, the best approach is to use a decoration file. Using a decoration file allows you to change the configuration in a target app without having to update a YAML-based definition. For example, to add a workflow to the Assets app, override the configuration for the publish and unpublish actions.

When two decorators are decorating the same part of a definition, the last decoration applied wins, however, keep in mind that decorations are applied in the module load order. Find out more about module dependencies and their loading order over here.

/my-module/decorations/dam-app/apps/dam.yaml
subApps:
  jcrBrowser:
    actions:
      publish: !override &publish
        $type: openDialogAction
        dialogId: workflow-pages:publish
        icon: icon-publish
        availability:
          rules:
            notDeleted: &notDeleted
              $type: jcrIsDeletedRule
              negate: true
            isPublishable: &isPublishable
              $type: jcrPublishableRule
      publishRecursive: !override
        $type: openDialogAction
        dialogId: workflow-pages:publishRecursive
        icon: icon-publish-incl-sub
        availability:
          rules:
            notDeleted: *notDeleted
            hasSubPages:
              $type: jcrHasChildrenRule
              nodeTypes:
                - mgnl:folder
                - mgnl:asset
            isPublishable: *isPublishable
      unpublish: !override &unpublish
        $type: openDialogAction
        dialogId: workflow-pages:unPublish
        icon: icon-unpublish
        availability:
          rules:
            notDeleted: *notDeleted
            isPublished:
              $type: jcrPublishedRule
      publishDeletion: !override
        $type: openDialogAction
        dialogId: workflow-pages:publishDeletion
        icon: icon-unpublish
        availability:
          multiple: true
          rules:
            isDeleted: &isDeleted
              $type: jcrIsDeletedRule
              negate: false
      deletePermanently:
        label: actions.requestPermanentDeletion.label
        $type: openDialogAction
        dialogId: workflow-pages:publishDeletion
        icon: icon-delete
        availability:
        multiple: true
        rules:
          isDeleted: *isDeleted

Custom content apps

With custom apps, the best approach is to configure the actions directly in the YAML descriptor. Copy the actions from the above decoration file and paste them into the actions block of your browser subapp.

Configuration

The example above is just one way to configure a workflow for the Assets app. Other options exist if you want to configure things differently.

Commands

The Workflow module provides two commands for publication (activate and deactivate) that can be configured in /modules/workflow/commands/workflow. Both activate and deactivate are command chains that call VersionCommand before the respective actions.

Scheduling

The above workflow supports scheduling, which is how the Pages app works out of the box. You can schedule publication and unpublication for a later date but still execute the workflow immediately.

Default scheduling is configured in the publish dialog. You can disable scheduling by deleting publicationDate from the dialog.

form:
  properties:
    comment:
      $type: textField
      rows: 5
  publicationDate:
    $type: dateField
    time: true

actions:
  commit:
    class: info.magnolia.module.workflow.action.WorkflowCommandActionDefinition

Adding custom parameters

You can pass custom parameters from your action definition into the process using the params node in the action configuration. You can reference the parameters in the process as described in Input and output parameters.

actions:
  publish:
    $type: openDialogAction
    dialogId: workflow-pages:publish
    icon: icon-publish
    availability:
      rules:
        notDeleted: &notDeleted
          $type: jcrIsDeletedRule
          negate: true
        isPublishable: &isPublishable
          $type: jcrPublishableRule
    params:
      param1: value1
      param2: value2
Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the DX Core docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules