JAVA WCMMODES
/** @return true if we are in edit mode, otherwise false */
public final boolean isEditMode() {
return WCMMode.fromRequest(getRequest()) == WCMMode.EDIT;
}
/** @return true if we are in preview mode, otherwise false */
public final boolean isPreviewMode() {
return WCMMode.fromRequest(getRequest()) == WCMMode.PREVIEW;
}
/** @return true if we are in publish mode, otherwise false */
public final boolean isPublishMode() {
return WCMMode.fromRequest(getRequest()) == WCMMode.DISABLED;
}
/** @return true if we are in design mode, otherwise false */
protected final boolean isDesignMode() {
return WCMMode.fromRequest(getRequest()) == WCMMode.DESIGN;
}
JS WCMMODES
function CustomWCMMode() {
this.isPublish = function() {
return (!ContextHub.Utils.Cookie.exists('wcmmode'));
}
this.isEditMode = function() {
return (ContextHub.Utils.Cookie.getItem('wcmmode') === 'edit');
}
this.isPreviewMode = function() {
return (ContextHub.Utils.Cookie.getItem('wcmmode') === 'preview');
}
this.isDesignMode = function() {
return (ContextHub.Utils.Cookie.getItem('wcmmode') === 'design');
}
};
var customWcmMode = new CustomWCMMode();
SIGHTLY WCMMODES
Publish : ${wcmmode.disabled}
Edit : ${wcmmode.edit}
Design : ${wcmmode.design}
Preview : ${wcmmode.preview}
Switch to preview to edit mode or vice versa by url
url?wcmmode=edit/preview/disabled
No comments:
Post a Comment