Foren

How to modify the default "look and feel" for web content display portlet

chris anderson, geändert vor 12 Jahren.

How to modify the default "look and feel" for web content display portlet

New Member Beiträge: 9 Beitrittsdatum: 09.04.10 Neueste Beiträge
Hi,

I'd like to turn off the "show borders" option by default in the look and feel for the web content display portlet. I'd like it to work such that the default stays and any new web content portlets added to a page will have the borders off by default. Any clues on how to do this?

TIA,
Chris
thumbnail
Shagul Khajamohideen, geändert vor 12 Jahren.

RE: How to modify the default "look and feel" for web content display portl

Liferay Master Beiträge: 758 Beitrittsdatum: 27.09.07 Neueste Beiträge
chris anderson:
Hi,

I'd like to turn off the "show borders" option by default in the look and feel for the web content display portlet. I'd like it to work such that the default stays and any new web content portlets added to a page will have the borders off by default. Any clues on how to do this?

TIA,
Chris


You could use the below property to override the default behavior, but it will affect for all portlets.

  #
    # Set this to true to decorate portlets by default.
    #
    theme.portlet.decorate.default=true
thumbnail
Thiago Leão Moreira, geändert vor 12 Jahren.

RE: How to modify the default "look and feel" for web content display portl

Liferay Legend Beiträge: 1449 Beitrittsdatum: 10.10.07 Neueste Beiträge
You can create a hook and a PorletPreferences listener to make this change. Use the method onBeforeCreate to check if you are adding a Web Content Display to the page, if so you set the preference portlet-setup-show-borders to false. BUT I'm not sure if this will work for the first time since we load the portlet using ajax. Let us know if works.
chris anderson, geändert vor 12 Jahren.

RE: How to modify the default "look and feel" for web content display portl

New Member Beiträge: 9 Beitrittsdatum: 09.04.10 Neueste Beiträge
Thanks guys for your reponses. Thiago, I think your solution will work best for me. Could you point me in the right direction for how to create a hook for portletpreferences? I found this class here:

com.liferay.portal.model.PortletPreferencesListener

However, the .class file for this class doesn't appear to be included with other listeners in portal-service.jar (for LR6). So I am getting "import cannot be resolved" errors when I try to compile a hook using this class.

Thanks again,
thumbnail
Thiago Leão Moreira, geändert vor 12 Jahren.

RE: How to modify the default "look and feel" for web content display portl

Liferay Legend Beiträge: 1449 Beitrittsdatum: 10.10.07 Neueste Beiträge
You can start form here: http://www.liferay.com/documentation/liferay-portal/6.0/development/-/ai/hooks and create a property value.object.listener.com.liferay.portal.model.PortletPreferences=com.liferay.portal.model.MySpecialPortletPreferencesListener and a class MySpecialPortletPreferencesListener extending BaseModelListener<PortletPreferences>.

Hope this helps
chris anderson, geändert vor 12 Jahren.

RE: How to modify the default "look and feel" for web content display portl

New Member Beiträge: 9 Beitrittsdatum: 09.04.10 Neueste Beiträge
Thiago -- Thanks much for your input. I believe this solution has worked for me. The only downside was that in the hook the portletID is a string that has the portlet "name" as a number + instance value etc, so I had to do some string magic to get the actual ID from it. But other than that it appears to working right away.

Also, I should point out that when setting the preference, the new value does not get reflected in the portlet configuration page (i.e. the "show borders" option is still checked even though the borders are off). I will be putting in a ticket with Liferay on this because any other configuration changes you make will cause the borders to turn back on.

Thanks again for your help --

Chris