Magnolia 5.4 reached end of life on November 15, 2018. This branch is no longer supported, see End-of-life policy.
The Content Dependencies module allows you to add a tab to a dialog that displays dependent items from both the current and other Magnolia workspaces. Editors can see what the consequence of deleting the item will be and whether dependent items need to be activated.
Content dependencies are references between content items. When a page links to another page, a dependency is created. Similarly, when a page uses assets from the DAM, a dependency exists between the page and the assets.
The module includes a preconfigured Dependencies tab that is designed to be added to a page properties dialog. The tab has two fields:
The Dependencies tab is configured in /modules/dependencies/dialogs/tabDependencies
. Both fields extend the reference
field configuration.
Node name | Value |
---|---|
dependencies | |
dialogs | |
reference | |
class | info.magnolia.module.dependencies.field.DependenciesFieldDefinition |
referencesTo | false |
tabDependencies | |
fields | |
referencesTo | |
references | |
pages | |
appMapping | app:pages:browser |
workspace | website |
extends | /modules/dependencies/dialogs/reference |
referencesTo | true |
referencesFrom | |
references | |
pages | |
appMapping | app:pages:browser |
workspace | website |
assets | |
pathResolver | |
class | info.magnolia.module.dependencies.field.resolver.AssetPathResolverImpl |
appLocationFactory | |
class | info.magnolia.module.dependencies.field.factory.DamAppLocationFactoryImpl |
appMapping | app:assets:browser |
workspace | dam |
extends | /modules/dependencies/dialogs/reference |
Properties:
tabDependencies | required Dependencies tab. |
| required Fields node. |
| required
|
| required References node. |
| required Arbitrary node name. One for each workspace you want to track. |
| optional Path resolver node. |
| optional, default is Default implementation returns a node's path. $webResourceManager.requireResource("info.magnolia.sys.confluence.artifact-info-plugin:javadoc-resource-macro-resources")
AssetPathResolverImpl
implements PathResolver for assets. |
| optional App location factory node. |
| optional, default is Default implementation creates an app's location. |
| required Subapp in |
| required Workspace name. |
| optional Node type. |
| optional Label displayed in dialog. |
| required $webResourceManager.requireResource("info.magnolia.sys.confluence.artifact-info-plugin:javadoc-resource-macro-resources")
DependenciesFieldDefinition
shows dependencies to and from workspaces. |
| optional, default is Whether items linking to the item should be included. |
The easiest way to make the Dependencies tab available to editors is to use the ready-made tab from the module.
tabDependencies
definition. Example: Adding Dependencies tab to MTE's pageProperties
dialog.
form: i18nBasename: info.magnolia.templating.models.messages label: pages.pageProperties.label tabs: - name: tabMain # Main tab configuration - name: tabMeta # Meta tab configuration - name: tabDependencies fields: - name: referencesTo class: info.magnolia.module.dependencies.field.DependenciesFieldDefinition referencesTo: true references: pages: appMapping: app:pages:browser workspace: website - name: referencesFrom class: info.magnolia.module.dependencies.field.DependenciesFieldDefinition referencesTo: false references: pages: appMapping: app:pages:browser workspace: website assets: appMapping: app:assets:browser workspace: dam patheResolver: class: info.magnolia.module.dependencies.field.resolver.AssetPathResolverImpl appLocationFactory: class: info.magnolia.module.dependencies.field.factory.DamAppLocationFactoryImpl actions: # Actions configuration
Node name | Value |
---|---|
pageProperties | |
form | |
tabs | |
tabMain | |
tabMeta | |
tabDependencies | |
extends | /modules/dependencies/dialogs/tabDependencies |
i18nBasename | info.magnolia.templatingkit.messages |
label | pages.pageProperties.label |
Here's the Dependencies tab after adding it to the Travel demo's Page properties dialog and viewing it on the About page.
All links are clickable and open the item in the target app.
Here are the components on the About page that are picked up in the depends on section of the dialog.
Reference properties are properties that the module uses 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 will not show up in the depends on section of the Dependencies tab.
Reference properties are configured in /modules/dependencies/config/referenceProperties
.
Example: Reference properties to display dependent pages from the website
workspace, and images and videos from the dam
workspace.
Node name | Value |
---|---|
dependencies | |
config | |
referenceProperties | |
linkTypepage | linkTypepage |
image | image |
assetsource | assetsource |
The easiest way to find the correct reference properties to configure is to look in the JCR Browser app.
Here is the video component (column 1) and Our Company teaser component (column 2) on the About page in the website
workspace in the JCR browser.
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.
Deletion warnings are configured in the confirmDeleteAsset
action defintion. The configuration patterns follows that of the Dependencies tab (above).
You can configure dependency-aware delete warnings in any app by adding a references
node to the delete confirmation action.
Example: confirmDeleteAsset
action in the Assets app configured in /modules/dam-app/apps/subapps/browser/actions/confirmDeleteAsset
.
subApps: browser: subAppClass: info.magnolia.ui.contentapp.browser.BrowserSubApp class: info.magnolia.ui.contentapp.browser.BrowserSubAppDescriptor actions: confirmDeleteAsset: icon: icon-delete successActionName: delete class: info.magnolia.module.dependencies.action.DependencyAwareConfirmationActionDefinition availability: multiple: true writePermissionRequired: true rules: - name: IsNotDeletedRule implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule references: - name: website nodeType: mgnl:page workspace: website
Node name | Value |
---|---|
subApps | |
browser | |
actions | |
confirmDeleteAsset | |
availability | |
references | |
website | |
nodeType | mgnl:page |
workspace | website |
class | info.magnolia.module.dependencies.action.DependencyAwareConfirmationActionDefinition |
icon | icon-delete |
successActionName | delete |
Properties
<action name> | required Action node. |
| required References node. |
| required Arbitrary node name. One for each workspace you want to track. |
| required Same properties as Dependencies tab. |
| required $webResourceManager.requireResource("info.magnolia.sys.confluence.artifact-info-plugin:javadoc-resource-macro-resources")
DependencyAwareConfirmationActionDefinition
adds dependency awareness to the action. |
| optional CSS class that identifies an icon font used on the action. See Icons. |
| required Name of action to execute on confirmation. |