legacy-knowledge-base
公開されました Jul. 2, 2025

埋め込み型Asset Publisherにカテゴリの配列を渡すにはどうすればよいですか?

written-by

Alfonso Crisci

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

問題

  • 埋め込み型Asset Publisherにカテゴリの配列を渡すにはどうすればよいですか?

Environment

  • Liferay DXP 7.0+

解決策

  • 7.0では、カスタムテーマの portal_normal.ftl にこのようなものを配置することができます:
    <#assign VOID = freeMarkerPortletPreferences.setValue("queryValues0",["assetCategory1.getCategoryId()","assetCategory2.getCategoryId()"]

    <@liferay_portlet["runtime"]
    defaultPreferences="${freeMarkerPortletPreferences}"
    instanceId="MyID1234"
    portletProviderAction=portletProvideAction.VIEW
    portletName="com_liferay_asset_publisher_web_portlet_AssetPublisherPortlet"
    />
  • 7.1+では、 setValue が非推奨となりました。したがって、同じ結果を得るには、 LPS-109837 の修正がインストールされていることを確認し、以下のようなフリーマーカーコードを使用してください:
            <#assign prefs = {
    "queryContains0":"true",
    "queryAndOperator0":"false",
    "queryName0":"assetCategories",
    "queryValues0": ["assetCategory1.Id","assetCategory2.Id"]
    } />

    <@liferay_portlet["runtime"]
    defaultPreferences = freeMarkerPortletPreferences.getPreferences(prefs)
    instanceId="coolInstanceId7777"
    portletProviderAction=portletProviderAction.VIEW
    portletName="com_liferay_asset_publisher_web_portlet_AssetPublisherPortlet"
    />
    ここで、 queryValues0 の値は、DB AssetCategory.categoryid 'のカラムから取得されます。

追加情報

did-this-article-resolve-your-issue

legacy-knowledge-base