Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Extending Digital Assets with custom fields and functionality

Avatar

Level 2

I have a requirement to extend fields on images, and to add some custom logic, so I have created a structure shown in the image here:

[img]assetEditor.png[/img]

This works for adding extra fields, but I also need a custom logic that will look for if the main image is selected on the current image, and check current folder, and remove main image check from image that has that selected.

Is this possible to implement and how? I have tried adding listeners to asseteditor widget but statesave or beforestatesave do not work at all, meaning that it does not activate while clicking on save.

Here is the example of the asseteditor widget and the listener i have tried:

<?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="cq:Widget" jcr:title="Image Asset Editor" sling:resourceType="cq/ui/components/widget" scene7="{Boolean}true" scene7Type="image" xtype="asseteditor"> <listeners jcr:primaryType="nt:unstructured" beforestatesave="function(field){ console.log('activate form save'); }"/> </jcr:root>
1 Accepted Solution

Avatar

Correct answer by
Level 10
1 Reply

Avatar

Correct answer by
Level 10