AEM 6 SP1 - Classic UI change Page Properties Dialog Ok button to Save

Goal


Just some quick sample JS code to change the text of OK button to Save in Page Properties Dialog


No Extension



Extension



Solution


1) Login to CRXDE Lite (http://localhost:4502/crx/de) and create folder /apps/classic-page-properties-buttons

2 Create node /apps/classic-page-properties-buttons/clientlib of type cq:ClientLibraryFolder and add a String property categories with value cq.widgets

3) Create file (nt:file) /apps/classic-page-properties-buttons/clientlib/js.txt and add

                      change-ok-to-save.js

4) Create file (nt:file) /apps/classic-page-properties-buttons/clientlib/change-ok-to-save.js and add the following code.

(function(){
    if( ( window.location.pathname !== "/cf" ) && ( window.location.pathname.indexOf("/content") !== 0)){
        return;
    }

    var SK_INTERVAL = setInterval(function(){
        var sk = CQ.WCM.getSidekick();

        if(sk){
            clearInterval(SK_INTERVAL);

            var dialog = CQ.WCM.getDialog(sk.initialConfig.propsDialog);

            if(dialog){
                dialog.success = function(form, action) {
                    CQ.Util.reload(CQ.WCM.getContentWindow());
                };

                var okButton = dialog.buttons[0];

                okButton.setText("Save");
            }
        }
    }, 250);
})();

No comments:

Post a Comment