Adding new action to an AEM Assets Toolbar consists of 2 steps:
- Configure the new action for the toolbar
- Add a client library to execute some operation on clicking the action.
In the following example, we are adding ability to publish and unpublish assets from the Collection view.
Step 1: Resolving the location of toolbar in CRXDE.
A toolbar’s location can easily be resolved via its page URL.
- Copy the URL of the page.
- Replace “/mnt/overlay” with “/libs” to resolve toolbar’s path. In our current example:
- Page URL: /mnt/overlay/dam/gui/content/collections/collectiondetails
- Toolbar’s location: /libs/dam/gui/content/collections/collectiondetail
Step 2: Add the new action to the toolbar
- In CRXDE, locate the toolbar via the path resolved in Step-1.
- Browse to “<Toolbar’s path>/jcr:content/actions”.
- Overlay actions node in “/apps”. This is to ensure that the customization are only done in “/apps” and NOT “/libs”
- Add the new required action. In current example, we have copied publish and unpublish actions from:
- Source:
- /libs/dam/gui/content/assets/annotate/jcr:content/actions/selection/publish
- /libs/dam/gui/content/assets/annotate/jcr:content/actions/selection/unpublish
- Destination:
- /apps/dam/gui/content/collections/collectiondetail/jcr:content/actions/selection/publish
- /apps/dam/gui/content/collections/collectiondetail/jcr:content/actions/selection/unpublish
- Source:
- Visit the Collections View. Select an asset. Notice that publish and unpublish actions would now be available. But, clicking on will execute any operation
Step 3: Add clientlibs to execute an operation via the newly added actions
- In CRXDE, locate the toolbar via the path resolved in Step-1.
- Browse to “<Toolbar’s path>/jcr:content/head/clientlibs”.
- Overlay clientlibs node in “/apps”. This is to ensure that the customization are only done in “/apps” and NOT “/libs”
- Add the required client library to the “categories” property of “/apps/dam/gui/content/collections/collectiondetail/jcr:content/head/clientlibs”
- For the current example, we have added following client libraries:
- dam.gui.admin.publishasset.coral
- dam.gui.admin.unpublishasset.coral
- For the current example, we have added following client libraries:
Visit the Collections View. Select an asset. You should now be able to publish/unpublish an asset via Collection view 🙂
the destination path for the action nodes is listed incorrectly in the text, but is shown correctly in the screen shot. the path should read:
/apps/dam/gui/content/collections/collectiondetail/jcr:content/actions/selection/publish…
(note the “selection” level)
LikeLike
Thanks tim for suggesting the correction. I have updated the relevant text.
LikeLike