-
-
Save elikem/8e69cec212f00a0693373e6628fb5502 to your computer and use it in GitHub Desktop.
Read AEM runmodes from Sightly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var SlingSettingsService = Packages.org.apache.sling.settings.SlingSettingsService; | |
| use(function () { | |
| // Get runmodes and transform them into an object that is easier to read for Sightly | |
| var runmodesObj = {}; | |
| var runmodesSet = sling.getService(SlingSettingsService).getRunModes(); | |
| var iterator = runmodesSet.iterator(); | |
| while (iterator.hasNext()) { | |
| runmodesObj[iterator.next()] = true; | |
| } | |
| return { | |
| runmodes: runmodesObj | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div data-sly-use.logic="logic.js"> | |
| <p>Current runmodes: ${logic.runmodes}</p> | |
| <p data-sly-test="${logic.runmodes.samplecontent}">samplecontent runmode</p> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment