Overview

JavaScript Page Editor function hooks are available to modify CMS behavior for advanced integrations.

They can be used as follows:

<script>
if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onInit = function(jsh){
  alert('CMS Initialized');
};
</script>

cms.onInit

Fired after the core jsHarmony script is loaded, but before jsHarmony CMS scripts are loaded

if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onInit = function(jsh){
  /* Code Here */
};

cms.onLoad

Fired after the core jsHarmony CMS is loaded, but before the Page Editor is loaded

if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onLoad = function(jsh){
  /* Code Here */
};

cms.onLoaded

Fired when the jsHarmony CMS Page Editor is fully loaded

if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onLoaded = function(jsh){
  /* Code Here */
};

cms.onRender

Fired each time the Page Editor renders the page content (on load and after each save)

if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onRender = function(page){
  /* Code Here */
};

cms.onGetControllerUrl

Fired on initialization. Can be used to return the URL of a custom CMS Page Controller.

View the source code of jsharmony-cms/clientjs/jsHarmonyCMS.Controller.js for a more detailed example.

if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onGetControllerUrl = function(){
  return 'https://domain/path/to/controller.js';
};

cms.onGetFilePickerParameters

Override the standard file picker querystring parameters

if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onFilePickerCallback = function(filePickerType, url){
  if(overrideFilePicker){
    return { init_page_path: 'path/to/page'; }
  }
};

cms.onFilePickerCallback

Override the standard file picker completion callback

if(window.jsHarmonyCMSInstance) jsHarmonyCMSInstance.onFilePickerCallback = function(jdata){
  if(overrideFilePicker){
    //Handle response
    var cms = jsHarmonyCMSInstance;
    cms.filePickerCallback('path/to/path#@JSHCMS', jdata);
    return true;
  }
}
Loading
Loading