Unfortunately, there isn't a built-in method that:
- copies contents of the
cq:template
node or - creates a new node,
- sets a
sling:resourceType
property to the node.
When you drag the component from sidekick to parsys, your browser sends a HTTP POST request to the Sling. If the target component contains cq:template
subnode, this HTTP request will contain an additional property:
./@CopyFrom:/apps/my/component/cq:template
which takes care of setting default values. Because you want to do the same thing via API rather than HTTP request, you need a custom method.