【问题标题】:Liferay Theme Select Dropdown SettingLiferay 主题选择下拉设置
【发布时间】:2014-09-24 23:00:35
【问题描述】:

我该怎么做

  1. 在我开发的自定义主题中添加带有自定义值的选择下拉菜单?
  2. 还需要设置该选择下拉菜单的默认值。
  3. 根据此选择下拉值更改主题中的一些内容。

我正在寻找实现上述内容的代码示例。

【问题讨论】:

    标签: liferay-6 liferay-theme


    【解决方案1】:

    回答第一个和第二个问题:

    1. 在我开发的自定义主题中添加带有自定义值的 Select Dropdown?
    2. 还需要设置该选择下拉菜单的默认值。

    liferay-look-and-feel.xml 中,使用您的键添加选择主题设置

    <look-and-feel>
        <compatibility>
            <version>6.2.0+</version>
        </compatibility>
        <theme id="theme-id" name="theme-id" >
            <settings>
                <setting type="select" configurable="true" 
                    key="dropdown-title-key" 
                    options="select-option-1,select-option-2"                   
                    value="select-option-2" ></setting>
            </settings>
        </theme>    
    </look-and-feel>
    

    这些键应该在Language_en_US.properties 中有相应的文本值。这个属性应该通过一个钩子注入。 编写一个hook项目,在liferay-hook.xml中指定如下内容。

    <?xml version="1.0"?>
    <!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
    
    <hook>
        <portal-properties>portal.properties</portal-properties>
        <language-properties>
            content/Language_en_US.properties
        </language-properties>
    </hook>
    

    content 文件夹(应位于类路径中)中,输入在Language_en_US.properties 文件中的liferay 主题设置中指定的键的文本。

    dropdown-title-key=Choose a value from the dropdown
    select-option-1=This is Option 1
    select-option-2=This is Option 2
    

    回答第三个问题:

    1. 根据此选择下拉值更改主题中的一些内容。

    更改通常在完成选择下拉主题设置的主题的portal_normal.vm 文件中完成。

    #if($theme.getSetting("dropdown-title-key")=='select-option-1')
        ##Do Something Here
    #elseif($theme.getSetting("dropdown-title-key")=='select-option-2')
        ##Do Something Else Here
    #end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-28
      • 2021-03-11
      • 2020-12-14
      • 1970-01-01
      相关资源
      最近更新 更多