style attribute not being rendered
I'm trying to add a style dynamically with HTL.
HTL code is:
<section class="header-page" data-sly-attribute.style="${header.cssStyle}" data-sly-use.header="com.acme.foo.Header"> </section>And in my Java class I have:
public class Header extends WCMUsePojo { private String imagePath; @Override public void activate() throws Exception { ValueMap properties = getProperties(); this.imagePath = properties.get("fileReference", ""); } public String getCssStyle() { return imagePath.isEmpty() ? "" : String.format("background-image: url('%s')", imagePath); } }But it's not being rendered, even when imagePath gets a valid value. I also tried using contexts, but nothing seems to be working.
Any ideas as what might be the problem?
Thanks
