Registering custom objects for WebContent Templates with TemplateContextContributor
Registering custom objects for WebContent Templates with TemplateContextContributor Sometimes you may need additional data to be available in the web content template. TemplateContextContributor can help in this case: Create class, that implements com.liferay.portal.kernel.template.TemplateContextContributor . Add @Component annotation to rigister it as OSGi-component. Override com.lif.app.display.contributor.AppDisplayContributor.prepare(Map<String, Object> contextObjects, HttpServletRequest request) method and put required object into contextObjects map. Deploy module with template context contributor. Use registered context in FTL template for web content. Example: @Component ( immediate = true , property = "type=" + TemplateContextContributor. TYPE_GLOBAL , service = TemplateContextContributor. class ) public class AppDisplayContributor implements TemplateContextContributor { private ...