Saturday, August 4, 2018
AEM 62 Classic UI show Nodename and not dc title or jcr title in Path Field of RTE Link Plugin Dialog
AEM 62 Classic UI show Nodename and not dc title or jcr title in Path Field of RTE Link Plugin Dialog
Goal
Show the node name and NOT dc:title or jcr:title in Pathfield widget of Link plugin dialog
For showing node name in Classic UI Pathfield widget browse dialog check this post
Demo | Package Install
Product

Extension

Solution
1) Login to CRXDE Lite, create folder (nt:folder) /apps/eaem-classicui-rte-link-pathfield-show-nodename-not-dctitle
2) Create clientlib (type cq:ClientLibraryFolder) /apps/eaem-classicui-rte-link-pathfield-show-nodename-not-dctitle/clientlib and set property categories of String type to cq.widgets and dependencies to underscore
3) Create file ( type nt:file ) /apps/eaem-classicui-rte-link-pathfield-show-nodename-not-dctitle/clientlib/js.txt, add the following
show-nodename.js
4) Create file ( type nt:file ) /apps/eaem-classicui-rte-link-pathfield-show-nodename-not-dctitle/clientlib/show-nodename.js, add the following code
(function(){
var EAEM_LINK_DIALOG = CQ.Ext.extend(CQ.form.rte.plugins.LinkDialog, {
constructor: function(config) {
config = config || {};
EAEM_LINK_DIALOG.superclass.constructor.call(this, config);
var pathField = this.findByType("pathfield")[0];
pathField.on("dialogopen", function(){
this.browseDialog.treePanel.on(load, showNodeName);
});
function showNodeName(node){
_.each(node.childNodes, function(childNode){
//set the nodename replacing jcr:title (folders) or dc:title (assets)
childNode.setText(childNode.attributes.name);
});
}
}
});
CQ.Ext.reg("rtelinkdialog", EAEM_LINK_DIALOG);
}());