Liferay 7.0 - making all Portlets Borderless by default via theme

早过忘川 提交于 2019-12-12 04:34:26

问题


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.


回答1:


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.




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/41532143/liferay-7-0-making-all-portlets-borderless-by-default-via-theme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!