How do I add Portlet Preferences in Liferay 7, as we don't have portlet.xml anymore, what is the equivalent for the following in Liferay 7(OSGi Bundle).
<portlet-preferences>
<preference>
<name>isVeg</name>
<value>VEG</value>
</preference>
</portlet-preferences>
According to the Portlet Descriptor to OSGi service property Map:
@Component ( ...
property="javax.portlet.preferences=<String>"
...
)
What this map leaves open is the syntax for the key-value pair. I'd start experimenting to duplicate the syntax of init-param
, can't tell the exact syntax from the top of my head.
Edit: As stated in the comment, a quick look up in Liferay's source code reveals the following style, which is the only style used in Liferay itself:
"javax.portlet.preferences=classpath:/META-INF/portlet-preferences/default-portlet-preferences.xml"
Naturally, as this doesn't contain the values itself, you'll need to include them in your bundle as well (see the linked sample).