Liferay 7.0 - making all Portlets Borderless by default via theme

2.2k views Asked by At

After searching for a solution to the problem of setting portlets default look and feel through the theme, I have tried the following in WEB-INF/liferay-look-and-feel.xml:

<setting configurable="true"
         key="portlet-setup-show-borders-default"
         type="checkbox"
         value="false"
/>

However, it does not seem to work on Liferay 7.0 GA3, and have run out of places to look for a solution.

My requirements are for a default portlet behavious where all decaration is disabled, i.e. borders and title and whatever else.

Worth mentioning that I'm using the new theme generator/Gulp build pipeline. Any pointers much appreciated.

3

There are 3 answers

0
netlander On

Along with the setting mentioned in the question comment out or remove from the bottom of portlet.ftl as follows:

<div class="${portlet_content_css_class}">
<#--<#if portlet_display.isShowBackIcon()>-->
    <#--<a class="icon-monospaced portlet-icon-back text-default" href="${portlet_back_url}" title="<@liferay.language key="return-to-full-page" />">-->
        <#--<@liferay_ui["icon"]-->
                <#--icon="angle-left"-->
        <#--markupView="lexicon"-->
            <#--/>-->
    <#--</a>-->
<#--</#if>-->

    <#--<h2 class="portlet-title-text">${portlet_title}</h2>-->

${portlet_display.writeContent(writer)}
</div>

This should remove all portlets title such that you cannot have a titled portlet on a site that uses this theme which is exactly what I want.

0
M Williams On

In case anyone else stumbles upon this question, this feature has been replaced with Portlet Decorators in Liferay 7. You can read more about this in the documentation: https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/portlet-decorators

0
Victor On

There is a minor conceptual problem with this method: The settings entry on WEB-INF/liferay-look-and-feel.xml is only used to give you a configuration option, regardless how you actually implement its behavior. Your proposed solution works, but its not due the settings entry - which does not seem to be used by your template, try toggling it in your theme configuration through the UI...

Without changing your template, avoiding hidden features in the UI, you could use decorators. Like in

<portlet-decorator id="borderless" name="Borderless">
    <default-portlet-decorator>true</default-portlet-decorator>
    <portlet-decorator-css-class>portlet-borderless</portlet-decorator-css-class>
</portlet-decorator>

This config within the same file would enable you to create a CSS class, like this one:

.portlet-borderless {

    .portlet-content-editable {
        border-style: none;
    }

    .portlet-content {
        background: rgba(255,255,255,.90);
    }
}

This class will be applied to all portlets, as it is marked as default in the xml file.