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
10 months agoTony
10 months agoStevie
10 months agoElenora
10 months agoHello World
because it seems like it could be the correct format for rendering only in edit mode.Tamar
10 months agoHello World
as it is more commonly used in practice.Clare
10 months agoHello World
because it is the correct syntax for rendering in edit mode.Dorothy
10 months agoHello World
might also work, as it seems to reference the editor mode.Kristal
10 months agoHello World
as it directly checks if the page is in edit mode.Alana
12 months agoHello World
because it checks if the page is in edit mode correctly.