Search code examples
aemaem-6

AEM 6.2 Adding new fields to folder settings but data is not saved


I tried to add some fields to folder settings.

To do so I overlayed the file "/libs/dam/gui/content/assets/foldersharewizard" in my apps. Added a new tab and 2 new checkboxes. The new tab and fields appear, but they don't save their values neither in the folder node nor jcr. I tried modifying default fields and when I change names I just stops working.

Here is my added code in foldersharewizard:

<tab5
    jcr:primaryType="nt:unstructured"
    jcr:title="Tab title"
    sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
    <editDeny
            jcr:primaryType="nt:unstructured"
            sling:resourceType="granite/ui/components/foundation/form/checkbox"
            id="editDeny"
            name="custom:deniedEdit"
            text="Hide edit"
            value="{Boolean}true"/>
    <delAllow
            jcr:primaryType="nt:unstructured"
            sling:resourceType="granite/ui/components/foundation/form/checkbox"
            id="delAllow"
            name="custom:allowedDel"
            text="Show delete"
            value="{Boolean}true"/>
</items>

As AEM documentation is mostly crap and not a lot of developer comments on the Internet... I'm out of ideas and if any of you struggled with the same problem or knows what I'm missing, it would be great.

Anything else you would like my to paste... but that's just all my added code.

Thank you.


Solution

  • <operation jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/foundation/form/hidden"
    name=":operation"
    value="custom.dam.share.folder"/>
    

    had to overlay this node to call a custom PostOperation

    @Component(metatype = false)
    @Service
    @Properties({@Property(name = "sling.post.operation", value = {"custom.dam.share.folder"}), @Property(name = "sling.servlet.methods", value = {"POST"})})
    public class CustomFolderShareHandler implements PostOperation {
    
        @Reference(target = "(sling.post.operation=dam.share.folder)")
        PostOperation folderShareHandler;
    
        @Override
        public void run(SlingHttpServletRequest request, PostResponse response, SlingPostProcessor[] processors) {
            folderShareHandler.run(request, response, processors);
            // DO CUSTOM STUFF
        }
    }