-
Notifications
You must be signed in to change notification settings - Fork 3
WCMMode Helpers
David Steele edited this page Aug 25, 2014
·
5 revisions
ironsites
ironsites provides a Map JSP variable and PageContext object called "ismode" which contains a boolean value comparing a key corresponding to each WCMMode and an equals comparison against the current WCMMode. Usage is predicated on the taglib declaration found in /apps/ironsites/common/global.jsp. Additionally, the WCMMode object is also exposed. The below expresses how much boilerplate is removed by this.
<% if (!WCMMode.EDIT.equals(WCMMode.fromRequest(sling.getRequest()))) { %> ... <% } %>
feels batman
<c:if test="${'EDIT' ne wcmmode}">...<c:if>
feels betterman
<c:if test="${not ismode.edit}">...<c:if>
feels goodman
Moreover, you can force a wcmmode if it is valid. This should scale to some of the newer modes going forward.
<isw:wcmmode mode="disabled">Disabled mode!</isw:wcmmode>