Hi All,
Just thought I'd put this here in case it's of use to anybody.
I've noticed a change in behavior from TeamSite/LiveSite 7.3.1 to 7.4.1 (technically I'm testing on 7.4.1.1, which is Update 1) in regards to page render mode context. This is in regards to components.
In 7.3.1,
RequestContext.isRuntime() would be
true when the page was rendered on a
LiveSite server.
RequestContext.isPreview() would be
true when the component was viewed on the
TeamSite server in any of the following contexts:
- Page preview
- Page edit
- Component preview
This was at the time a bug, in that Page edit should not be identified as preview, which I worked with support through, and their update seems to have arrived sometime before 7.4.1.1. However, its introduced new bugs which breaks compatibility with our existing code.
With 7.4.1.1 on the
LiveSite server both
RequestContext.isRuntime() and
RequestContext.isPreview() are
false. On
TeamSite both
RequestContext.isRuntime() and
RequestContext.isPreview() are
true for
Page preview, and both are
false for
Page edit and
Component preview.
Unfortunately, this breaks a lot of our components that relied on those 2 properties to determine what to show (we display different output to users (editors) on TeamSite to our final version.
However, their fix does appear to make the
ContextMode class correctly identify the
EDIT context, so now to correctly determine the mode you should use
ContextMode.getMode().name() which has the choices:
RUNTIME,
PREVIEW,
EDIT,
GENERATE_HTML and
EMBEDDED.
Based on the list above the following are the current modes:
- Page render (LiveSite) - RUNTIME
- Page preview (TeamSite) - PREVIEW
- Page edit - EDIT
- Component preview - EDIT
- Generate HTML - GENERATE_HTML (though I've not actually confirmed this)
Just an FYI for anyone upgrading and who leverages those isPreview()/isRuntime() methods in their component code. I've raised a ticket with support as well.