legacy-knowledge-base
公開されました Jun. 30, 2025

ウィジェットページテンプレート内で実行されるメソッド「themeDisplay.getScopeGroupId()」で、サイトのグループIDが取得されない

written-by

Daniel Couso

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

問題

  • Widget Page Templateがある場合、Freemarkerテンプレートから themeDisplay.getScopeGroupId() メソッドを使用して、オリジナルサイトの groupId を取得しようとすると、異なる groupId が取得される。
  • 他の方法で復旧させることは可能でしょうか?

Environment

  • Liferay DXP 7.1+

解決策

  • ウィジェットページテンプレートは、定義上、独自のサイトを作成するため、 themeDisplay.getScopeGroupId() を使用すると、元のサイトの groupIdではなく、(ページテンプレート用に)新たに作成されたサイトの groupId を取得します。
  • ただし、これらのウィジェットページテンプレートは、ページテンプレートコレクションを通じて、元のサイト(作成場所)に接続されています。
  • 元のサイトの groupIdを取得するには、その LayoutPageTemplateEntryから行う必要があります。以下の記事で、出発点として使用できる例があります:

did-this-article-resolve-your-issue

legacy-knowledge-base