I have a utility to access my custom Liferay configuration (not default Liferay), and I am able to do what I want in java code, but when it comes to freemarker I got stuck.
Here is my class that I want to access in Liferay theme freemarker Template:
class name : CommonServicesUtil
package mycompany.liferay.modules.common_services.util;
public class CommonServicesUtil {
public static CommonServicesGroupConfiguration getCommonServicesGroupConfiguration(final long groupId) {
try {
return ConfigurationProviderUtil.getConfiguration(CommonServicesGroupConfiguration.class, new GroupServiceSettingsLocator(groupId, CommonServicesConstants.COMMON_SERVICES_API_BUNDLE_NAME));
} catch (ConfigurationException ex) {
throw new ArenaRuntimeException(ex.getMessage(), ex);
}
}
public static CommonServicesSystemConfiguration getCommonServicesSystemConfiguration() {
try {
return ConfigurationProviderUtil.getSystemConfiguration(CommonServicesSystemConfiguration.class);
} catch (ConfigurationException ex) {
throw new ArenaRuntimeException(ex.getMessage(), ex);
}
}
}
in freemarker I tried the follwoing :
\<#assign configuration = serviceLocator.findService("mycompany.liferay.modules.common_services.util.CommonServicesUtil")\>
\<#assign ConfigurationProvider = objectUtil("mycompany.liferay.modules.common_services.util.CommonServicesUtil") /\>
\<#assign ConfigurationProvider = staticUtil\["mycompany.liferay.modules.common_services.util.CommonServicesUtil"\] /\>
My liferay version is 7.4
I am trying to access the configuration that I have been added to Liferay configuration