Manan Kapoor February 2016

show current page path in paragraph reference in AEM

I am having dialog with xtype field as "paragraphreference". When i open the field it is showing the whole content repository. I want to show only current page path in the paragraph reference field. I dont want to overlay the js file. Is there any other solution or property which can give the current page path to show.

Please suggest.

Answers


Niks February 2016

You can do it with custom widget plugin. First, add property plugins to your pathfield in the dialog.xml:

<myPathComponent
    jcr:primaryType="cq:Widget"
    fieldLabel="My path component"
    plugins="customRootPathPlugin"
    xtype="pathfield" />

Then create custom ExtJS plugin. In order to do that, create new JS file, and add it to clientlib with cq.wcm.edit category. Plugin can look like that:

(function($) {
var plugin = CQ.Ext.extend(CQ.Ext.emptyFn, {
    init: function(widget) {
       var currentPath = CQ.WCM.getPagePath();
        widget.treeRoot.name = currentPath;
    }
});

CQ.Ext.ComponentMgr.registerPlugin('customRootPathPlugin', plugin);

}($CQ));

Also you can take ref from : Click

Post Status

Asked in February 2016
Viewed 1,904 times
Voted 6
Answered 1 times

Search




Leave an answer