Is it possible to pass a variable to the data-sly-use statement using HTL Sightly Use API while also specifying a bundle? For example
<sly data-sly-use.help="${'com.company.service.Helper' @ myVar='hello!'}"></sly>
with the helper
package com.company.service;
import com.adobe.cq.sightly.WCMUsePojo;
public class Helper extends WCMUsePojo {
@Override
public void activate() throws Exception {
String myVar = getProperties().get("myVar", String.class);
// why is myVar is null?
}
}
If it makes a difference, this is in AEM 6.4.3.0
When extending WCMUsePojo
you need to use the get
(https://helpx.adobe.com/experience-manager/6-2/sites/developing/using/reference-materials/javadoc/com/adobe/cq/sightly/WCMUsePojo.html#get(java.lang.String,%20java.lang.Class) ) method to be able to obtain the obiects passed as expression options.
Also have a look at the Passing Parameters section in https://docs.adobe.com/content/help/en/experience-manager-htl/using/htl/use-api-java.html