1

I am struggling with a problem which can be solved by getting absolute WCMMode of the page.

By absolute WCMMode, I mean the WCMMode independent of the components. For example, generally if we try to get the WCMMode of a component then it returns "EDIT" only if the component is configurable at that page. If a component is not configurable at a particular page, then it returns WCMMode value as "PREVIEW".

> <%=WCMMode.fromRequest(slingRequest)%>

The problem can be solved by checking on the behaviour of sidekick. But this way is a bit risky.

> CQ.WCM.isSidekickReady() &&
> CQ.WCM.getContentWindow().CQ.WCM.areEditablesReady()

Is there any other way to get this problem solved? Please share your ideas.

Jasraj Suthar
  • 423
  • 5
  • 8

1 Answers1

2

Generally in an authoring environment you should be able to get away by checking if a component is in Edit Mode or Preview Mode.

<%

WCMMode wcmMode = WCMMode.fromRequest(slingRequest)

if(wcmMode.equals(WCMMode.EDIT) || wcmMode.equals(WCMMode.PREVIEW))
{

    // do your stuff.
}


%>

Other than this is no other way to determining the absolute WCMMode which you are looking for. It would be great if you can tell me your case and what you are looking for.

Rajesh Pantula
  • 10,061
  • 9
  • 43
  • 52