A developer wants to render Hello World' only in edit mode. Which approach would be used?
In AEM, the Sightly/HTL scripting language is used to develop robust and secure components. To render content conditionally based on the WCM (Web Content Management) mode, the wcmmode object is used. The correct property to check if the current mode is edit is wcmmode.edit. The HTL syntax for testing a condition is data-sly-test followed by the condition in ${}. The option B correctly uses this syntax to test if the WCM mode is edit, and if so, renders 'Hello World'.
Option A uses wcm.edit which is not the correct object property.
Option C uses wcmmode editor which is not the correct property and the syntax has a typo (should be data-sly-test).
Raymon
5 months agoTony
5 months agoStevie
5 months agoElenora
5 months agoHello World
because it seems like it could be the correct format for rendering only in edit mode.Tamar
5 months agoHello World
as it is more commonly used in practice.Clare
5 months agoHello World
because it is the correct syntax for rendering in edit mode.Dorothy
6 months agoHello World
might also work, as it seems to reference the editor mode.Kristal
6 months agoHello World
as it directly checks if the page is in edit mode.Alana
7 months agoHello World
because it checks if the page is in edit mode correctly.