This sections shows you how to configure and use the module.
Add show diff action to your app
subApps:browser:actions:diffWithPreviousVersion:label:'Show diff content'icon:icon-show-versions$type:openDialogActiondialogId:content-diff:contentDiffavailability:rules:notDeleted:$type:jcrIsDeletedRulenegate:truehasVersionsRule:$type:jcrHasVersionsRuleactionbar:sections:-name:item#please modify this name according to your section definitiongroups:-name:versioningitems:-name:diffWithPreviousVersionCopy
Configuration
You can configure from which workspace properties should get reference values.
This is done in your config.yaml file.
This configuration enable you configure for multiple apps by specify workspaceName property.
config.yaml
################# SPECIFY THE PROPERTY/WORKSPACE CONFIGURATION #################referencedConfigs:website:workspaceName:websitereferencedWorkspaces:image:damdepth:5(1)datePropertiesFormat:(2)scheduleDate:"yyyy-MM-dd"expiredDate:"datetime short"dataFormats:(3)meter:# propertyNameclass:# class which implement from DataConvertercurrency:# propertyNameclass:# class which implement from DataConverterexcludedNodeTypes:(4)-mgnl:componentVariants-mgnl:versionMetaDataexcludedNodeNames:(5)-footer-footer1-mgnl:versionMetaDataCopy
1
depth: the depth of the node you want to compare.
2
datePropertiesFormat: configure the date format for your properties.
3
dataFormats: support conversions to other data formats, such as currency or meters to feet.
4
excludedNodeTypes: the specific node types to be excluded.
5
excludedNodeNames: the specific property names to be excluded.
Data converter
Create a class implement (info.magnolia.content.diff.data.DataConverter) to convert and format specific data.
Example
publicclassMeterToFeetFormatimplementsDataConverter{
@Overridepublic String format(String propertyValue){
int meter = Integer.parseInt(propertyValue);
double feet = 3.281 * meter;
return String.valueOf(feet);
}
}Copy
Decoration
You can decorate your Content Diff module configuration based on your needs.
For example, if you needed to have an Award field for different apps.
config.yaml
################# SPECIFY THE MULTIPLE WORKSPACE CONFIGURATION #################referencedConfigs:hotels:workspaceName:hotelsreferencedWorkspaces:award:hotel-awardstours:workspaceName:toursreferencedWorkspaces:award:tours-awardsCopy
This can be done via a decorations registry in your own light module.
The decorations you define impact the Content Diff module’s config.yaml file.