Image credit Ahmed Musallam
Which of course leaves our authors wondering…
Sling Resource Merger
You’ll notice that the AEM UI components show up under the path /mnt/overlay[path], which means they are actually generated by Sling Resource Merger. This Apache Sling feature generates a merged set of resources based on multiple source paths, in the example of the AEM Assets UI, combining the paths:
NOTE: Any modification / override will need to be maintained, so keep in mind that during an upgrade the node structure, resource types or attributes may change so keep that in mind when deciding whether or not to overlay a default feature.
You’ll notice that the AEM UI components show up under the path /mnt/overlay[path], which means they are actually generated by Sling Resource Merger. This Apache Sling feature generates a merged set of resources based on multiple source paths, in the example of the AEM Assets UI, combining the paths:
- /apps/dam/gui/content/assets
- /libs/dam/gui/content/assets
- /mnt/overlay/dam/gui/content/assets
NOTE: Any modification / override will need to be maintained, so keep in mind that during an upgrade the node structure, resource types or attributes may change so keep that in mind when deciding whether or not to overlay a default feature.
Step 1: Add the Workflow Action
To push the workflow button up in the selections action list, you can copy:
/libs/dam/gui/content/assets/jcr:content/actions/selection/create/items/createworkflow to /apps/dam/gui/content/assets/jcr:content/actions/selection/startworkflow
and then update the sling:resourceType AND variant attributes to display as a regular action instead of a sub-action.
To push the workflow button up in the selections action list, you can copy:
/libs/dam/gui/content/assets/jcr:content/actions/selection/create/items/createworkflow to /apps/dam/gui/content/assets/jcr:content/actions/selection/startworkflow
and then update the sling:resourceType AND variant attributes to display as a regular action instead of a sub-action.
Step 2: Order the Workflow Action
By default the new workflow action will be put at the end of the action bar, so let’s have Sling Resource Merger insert the action between before some of the other actions. For example to place the Workflow button before the Extract Archive button, add the attribute: sling:orderBefore=”extractarchive”. When you refresh the Assets UI, you can now see that the button is now directly following the create button:
By default the new workflow action will be put at the end of the action bar, so let’s have Sling Resource Merger insert the action between before some of the other actions. For example to place the Workflow button before the Extract Archive button, add the attribute: sling:orderBefore=”extractarchive”. When you refresh the Assets UI, you can now see that the button is now directly following the create button:
Step 3: Hide Create > Workflow
Since we don’t want the same action to be available in multiple places, we can hide the original button by adding a node at:
/apps/dam/gui/content/assets/jcr:content/actions/selection/create/items/createworkflow
with the property sling:hideResource=true
Additionally, to prevent the create button from shifting to the last position, we need to set sling:orderBefore=”startworkflow” on the node:
/apps/dam/gui/content/assets/jcr:content/actions/selection/create
Try It Yourself
I’ve created a ready to go package if you wanted to try the tweak yourself. As noted above, you will need to check across AEM versions. I’ve tested it on 6.4 and 6.5, but even between those versions, the icon for workflow has changed.
Download the Package
I hope this helps you understand how you can use Sling Resource Merger to tweak the AEM UI as well as having some ideas of what impact this can have on your upgrade process.
Since we don’t want the same action to be available in multiple places, we can hide the original button by adding a node at:
/apps/dam/gui/content/assets/jcr:content/actions/selection/create/items/createworkflow
with the property sling:hideResource=true
Additionally, to prevent the create button from shifting to the last position, we need to set sling:orderBefore=”startworkflow” on the node:
/apps/dam/gui/content/assets/jcr:content/actions/selection/create
Try It Yourself
I’ve created a ready to go package if you wanted to try the tweak yourself. As noted above, you will need to check across AEM versions. I’ve tested it on 6.4 and 6.5, but even between those versions, the icon for workflow has changed.
Download the Package
I hope this helps you understand how you can use Sling Resource Merger to tweak the AEM UI as well as having some ideas of what impact this can have on your upgrade process.
No comments:
Post a Comment
If you have any doubts or questions, please let us know.