Our project is moving from Classic to Touch (AEM 6.3). Our content uses a custom service (generating a numeric string) for naming pages (i.e. "12345"). For page creation, the default pagename field has been replaced via overlay to have a hidden input field that is automatically populated by the service.
The problem comes with copying/pasting pages. By default, when pasting the page, the /bin/wcmcommand call in AEM appends the parent page name with a number (i.e. "123451"). We want it to instead call our service to get the next numeric string (i.e. "12346").
In classic, we were able to extend the CQ.wcm.SiteAdmin object in javascript with an overlay of /widgets/wcm/SiteAdmin.js, and within pasteFromClipboard it calls our service. But I am having trouble finding something similar in Touch UI. Is there a way to do this, to override the naming in Touch UI page Copy/Paste?
Solved! Go to Solution.
Thank you Gaurav for the information you provided. Although I ended up going a different route, I appreciate you taking the time.
What I ended up doing was overlaying /libs/cq/gui/components/common/wcm/clientlibs/wcm/js/copy.js , and within the .cq-wcm-paste-activator onClick function, the naming page service gets called and put into a new destName parameter. That is put in with the outputData array ( outputData.destName = newPageId;) before outputData is pushed into outputParams (outputParams.push(outputData);) The destName is also put in with the following $.ajax() data that is posted to COMMAND_URL. (This is very much like we were originally doing in Classic with SiteAdmin.js.)
The solution lies in /bin/wcmcommand, it initiates 'copyPage' command which maps to '/libs/wcm/core/content/sites/jcr:content/actions/selection/copypage' which in turn maps to '/libs/granite/ui/components/coral/foundation/collection/action'
Now '/libs/granite/ui/components/coral/foundation/collection/action' is granite:FinalArea which you should not overlay/overwrite but
you could certainly customize '/libs/wcm/core/content/sites/jcr:content/actions/selection/copypage' and attach your custom implementation to it.
Option #1: Override it, Create appropriate structure in /apps, use sling:resourcemerger to hide OOB implementation (i.e. sling:resourceType) and attach your custom implementation to this action. This way you would modify copyPage action globally for the entire AEM instance. You should localize the custom implementation to your project only.
Option #2: Create another custom icon similar to copy/paste and use that custom icon-action to solve your use case.
/bin/wcmcommand request data-
Views
Replies
Total Likes
Thank you Gaurav for the information you provided. Although I ended up going a different route, I appreciate you taking the time.
What I ended up doing was overlaying /libs/cq/gui/components/common/wcm/clientlibs/wcm/js/copy.js , and within the .cq-wcm-paste-activator onClick function, the naming page service gets called and put into a new destName parameter. That is put in with the outputData array ( outputData.destName = newPageId;) before outputData is pushed into outputParams (outputParams.push(outputData);) The destName is also put in with the following $.ajax() data that is posted to COMMAND_URL. (This is very much like we were originally doing in Classic with SiteAdmin.js.)
Views
Likes
Replies
Views
Likes
Replies