After much searching, I've created the hook myself. Follow these steps and user based portlet css will be enabled.
"top_head.jsp" found in "\html\common\themes" needs to be changed a bit.
Here is what you have to do:
Replace the code:
1PortletPreferences portletSetup = PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, portlet.getPortletId());
2
3String portletSetupCss = portletSetup.getValue("portlet-setup-css", StringPool.BLANK)
With:
1String portletId = portlet.getPortletId();
2PortletPreferences portletPreferences = PortletPreferencesFactoryUtil.getPortletPreferences(request, portletId);
3String portletSetupCss = portletPreferences.getValue("portletSetupCss", null);
4PortletPreferences portletSetup = PortletPreferencesFactoryUtil.getStrictLayoutPortletSetup(layout, portlet.getPortletId());
5
6if ( Validator.isNull(portletSetupCss) ) {
7 portletSetupCss = portletSetup.getValue("portletSetupCss", StringPool.BLANK);
8}
Now in your portlet create a preference by name = "portletSetupCss" and in your edit page store this string in the preference:
1public String portletCss = "{\"wapData\":{\"title\":\"\",\"initialWindowState\":\"NORMAL\"},\"borderData\":{\"borderStyle\":{\"top\":\"\",\"left\":\"\",\"bottom\":\"\",\"right\":\"\",\"sameForAll\":true},\"borderColor\":{\"top\":\"\",\"left\":\"\",\"bottom\":\"\",\"right\":\"\",\"sameForAll\":true},\"borderWidth\":{\"top\":{\"value\":\"\",\"unit\":\"px\"},\"left\":{\"value\":\"\",\"unit\":\"px\"},\"bottom\":{\"value\":\"\",\"unit\":\"px\"},\"right\":{\"value\":\"\",\"unit\":\"px\"},\"sameForAll\":true}},\"textData\":{\"fontSize\":\"<fontSize>\",\"fontStyle\":\"<fontStyle>\",\"fontFamily\":\"<fontFamily>\",\"color\":\"\",\"fontWeight\":\"\",\"textAlign\":\"\",\"wordSpacing\":\"\",\"lineHeight\":\"\",\"textDecoration\":\"\",\"letterSpacing\":\"\"},\"advancedData\":{\"customCSSClassName\":\"\",\"customCSS\":\"\"},\"spacingData\":{\"padding\":{\"top\":{\"value\":\"\",\"unit\":\"px\"},\"left\":{\"value\":\"\",\"unit\":\"px\"},\"bottom\":{\"value\":\"\",\"unit\":\"px\"},\"right\":{\"value\":\"\",\"unit\":\"px\"},\"sameForAll\":true},\"margin\":{\"top\":{\"value\":\"\",\"unit\":\"px\"},\"left\":{\"value\":\"\",\"unit\":\"px\"},\"bottom\":{\"value\":\"\",\"unit\":\"px\"},\"right\":{\"value\":\"\",\"unit\":\"px\"},\"sameForAll\":true}},\"bgData\":{\"backgroundColor\":\"\",\"backgroundPosition\":{\"top\":{\"value\":\"\",\"unit\":\"px\"},\"left\":{\"value\":\"\",\"unit\":\"px\"}},\"backgroundRepeat\":\"\",\"backgroundImage\":\"\",\"useBgImage\":false}}";
you can now edit this string in whatever way you like, and user based css will be applied.
Hope this helps!
Please sign in to flag this as inappropriate.