mercredi 4 mars 2015

hybris WCMS renderer pass attributes

I'm implementing a couple of CMS components via addOn extension and later add them to the storefront. I'm using a renderer instead of controller and I'm able to pass the attributes of my item to the jsp file. However, I have a problem, which might be pretty simple but I'm stuck. Let's say I want to pass the current user Id via the renderer to my JSP. Is this possible?



protected Map<String, Object> getVariablesToExpose(final PageContext pageContext, final C component)
{
final Map<String, Object> variables = new HashMap<String, Object>();
for (final String property : cmsComponentService.getEditorProperties(component))
{
try
{
final Object value = modelService.getAttributeValue(component, property);
variables.put(property, value);

}
catch (final AttributeNotSupportedException ignore)
{
// ignore
}
}
return variables;
}


This is my code to get the properties of my item type and their values. But I don't want to have additional field called user id in my CMS component.


Aucun commentaire:

Enregistrer un commentaire