Hi @fionas76543059,
For fetching the run modes, you can use SlingSettingsService.
Code:
@Reference
private SlingSettingsService slingSettingsService;
private Boolean isPublish;
private boolean isPublish() {
return this.slingSettingsService.getRunModes().contains("publish");
}
You can now expose this boolean in HTL like this:
${classObject.isPublish}
This resultant object value can be consumed by the Front end as mentioned here
As per my understanding what Jorg Hoh is trying to say is to separate the business logic and presentation logic.
Thanks,
Kiran Vedantam.