Content Dependencies module

Content management Bundled: DX Core

Edition DX Core

License

MLA

Issues

Maven site

Latest

2.0.4

Content dependencies are references between content items. When a page links to another page, a dependency is created. Similarly, when a page uses an asset from the DAM, a dependency is created between the page and the asset.

The Content Dependencies module displays dependencies between the selected content item and other items, whether the items reside in the same Magnolia workspace or in different ones. Editors can see the consequence of deleting the selected item and whether dependent items need to be published together.

Dependencies tab in Page properties

Installing with Maven

Bundled modules are automatically installed for you.

If the module is unbundled, add the following to your bundle including your project’s <dependencyManagement> section and your webapp’s <dependencies> section. If the module is unbundled but the parent POM manages the version, add the following to your webapp’s <dependencies> section.

<dependency>
  <groupId>info.magnolia.dependencies</groupId>
  <artifactId>magnolia-content-dependencies-parent</artifactId>
  <version>2.0.4</version> (1)
  <type>pom</type>
</dependency>
1 Should you need to specify the module version, do it using <version>.

Dependencies tab

A typical use case is adding a dependencies tab to a page properties dialog. The tab has two fields:

  1. Lists content items that link to the item

  2. Lists items the item links to.

Property Description

tabDependencies

required

Dependencies tab.

     fields

required

Fields node.

         <field name>

required

referencesFrom and referencesTo fields extend the generic references field.

             references

required

References node.

                 <workspace name>

required

Arbitrary node name. One for each workspace you want to track.

                     appMapping

required

Subapp in app:<app name>:<subapp name> format.

                     workspace

required

Workspace name.

                     nodeType

required

Node type.

                     referenceProperties

required

                     pathResolver

optional

Path resolver node.

                         class

optional, default is `info.magnolia.module.dependencies.field.resolver.PathResolverImpl`

Default implementation returns a node’s path. info.magnolia.module.dependencies.field.resolver.AssetPathResolverImpl implements PathResolver for assets.

                     appLocationFactory

optional

App location factory node.

                         class

optional, default is `info.magnolia.module.dependencies.field.factory.AppLocationFactoryImpl`

Default implementation creates an app’s location. info.magnolia.module.dependencies.field.factory.DamAppLocationFactoryImpl implements AppLocationFactory for the Assets app.

                     label

optional

Label displayed in dialog.

             class

required

info.magnolia.module.dependencies.ui.field.DependenciesViewDefinition shows dependencies to and from workspaces.

             referencesTo

optional, default is false

Whether items linking to the item should be included.

Adding dependencies tab to dialogs

Example: Adding a dependencies tab to MTK’s basic page dialog.

<light-module-folder>/<light-module-name>/decorations/mtk2/dialogs/pages/basic.yaml

form:
  properties:
    referencesTo:
      class: info.magnolia.module.dependencies.ui.field.DependenciesViewDefinition
      referencesTo: true
      references:
        pages:
          appMapping: app:pages-app:browser
          workspace: website
          referenceProperties:
            - link
            - linkTypepage #teaser component
    referencesFrom:
      class: info.magnolia.module.dependencies.ui.field.DependenciesViewDefinition
      referencesTo: false
      references:
        pages:
          appMapping: app:pages-app:browser
          workspace: website
          referenceProperties:
            - link
            - linkTypepage #teaser component
        assets:
          appMapping: app:dam:jcrBrowser
          workspace: dam
          referenceProperties:
            - image
            - thumbnail
          pathResolver:
            class: info.magnolia.module.dependencies.field.resolver.AssetPathResolverImpl
          appLocationFactory:
            class: info.magnolia.module.dependencies.field.factory.DamAppLocationFactoryImpl

  layout:
    tabs:
      - name: tabDependencies
        fields:
          - name: referencesTo
          - name: referencesFrom

Here is the dependencies tab after adding it to the Travel Demo’s Page properties dialog and viewing it on the About page.

  • This page is depended upon by:

    • Pages: Lists pages that link to the page.

  • This page depends on:

    • Pages: Lists pages the page links to.

    • Assets: Lists assets added to the page.

All links are clickable and open the item in the target app.

Dependencies tab in Page properties

Reference properties

Reference properties are properties that the module uses to retrieve nodes that an item depends on. They are typically properties that hold references to other nodes and whose value is the JCR identifier or UUID.

If you do not include the correct reference properties in your configuration, the items do not show up in the depends on section of the dependencies tab.

If you do not include any reference properties, the three default values (image, contact, and link) are used.

The easiest way to find the correct reference properties to configure is to export the JCR content or to look in the JCR Browser app.

Deletion Warnings

The module displays dependency-ware deletion warning messages in the Pages and Assets apps by default. The confirmation dialog lists links to the referring items that will be broken once the deletion is complete.

Delete item confirmation dialog

Deletion warnings are configured in the confirmDeleteAsset action defintion. The configuration patterns follow those of the dependencies tab (above).

You can configure dependency-aware delete warnings in any app by adding a references node to deleteConfirmationAction.

ConfirmDeletion action in the Assets app.

Property Description

<action name>

required

Action node.

     references

required

References node.

         <workspace name>

required

Arbitrary node name. One for each workspace you want to track.

             workspace

required

Workspace name.

             nodeType

required

Node type.

     class

required

info.magnolia.module.dependencies.ui.action.DependencyAwareConfirmationActionDefinition adds dependency awareness to the action.

     icon

optional

CSS class that identifies an icon used for the action. For available names, see Icons.

     successActionName

required

Name of action to execute on confirmation.

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