Which approach would be used?

A developer wants to render Hello World’ only in edit mode.

Which approach would be used?
A . <p data-sly-test=’${wcm. edit}" >Hello World</p>
B . <p data-sly-test=*${wcmmode.edit}’>Hello World</p>
C . <p data-sly-test=’${wcmmode editor}’>Hello World</p>

Answer: B

Explanation:

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).

Latest AD0-E123 Dumps Valid Version with 50 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments