Legacy Knowledge Base
公開されました Jun. 30, 2025

使用中のウィジェット・テンプレートを識別する方法を教えてください。

Written By

Emma Carr-Gardner

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

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

問題

  • どのウィジェットテンプレートが使用中であるかを知るには?
  • ウィジェットテンプレートがLiferayインスタンス全体で使用されている場所を確認するにはどうすればいいですか?

環境

  • Liferay DXP

解像度

  • Liferay DXP 7.4のユーザーは、UIを使ってどのテンプレートが使われているか、どこで使われているかを調べることができます。
    • 製品メニューへ移動 > デザイン > テンプレート > ウィジェットテンプレート
      • ここで使用件数を見ることができ、さらにアクションボタンをクリックすると、そのテンプレートの使用件数を見ることができます。


  • Liferay DXP 7.0-7.3のユーザーには、groovyスクリプト(ここに添付)を使うことができます。
    • コントロールパネル > サーバー管理 > スクリプトに移動し、添付のスクリプトを貼り付けます。
    • List<com.liferay.portal.kernel.model.PortletPreferences> portletPreferences = com.liferay.portal.kernel.service.PortletPreferencesLocalServiceUtil.getPortletPreferences();

      for (com.liferay.portal.kernel.model.PortletPreferences portletPreference : portletPreferences) {
      String preferencesXML = portletPreference.getPreferences();

      javax.portlet.PortletPreferences jxPortletPreferences = com.liferay.portal.kernel.portlet.PortletPreferenceskernel.portlet.PortletPreferencesFactoryUtil.fromDefaultXML(preferencesXML);

      String displayStyle = jxPortletPreferences.getValue("displayStyle", "");

      if (displayStyle.isEmpty()) {
      continue;
      }

      com.liferay.portal.kernel.model.Layout layout = com.liferay.portal.kernel.service.LayoutLocalServiceUtil.fetchLayout(portletPreference.getPlid());

      out.println( "テンプレート名: " + displayStyle);
      out.println( "レイアウト名:" + layout.getNameCurrentValue() + " Plid:" + portletPreference.getPlid());
      out.println( "PortletId:" + portletPreference.getPortletId());
      out.println( "----");
      }.

追加情報

Did this article resolve your issue ?

Legacy Knowledge Base