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

ウェブコンテンツが公開されているレイアウトを表示するオプションはどこにあるのでしょうか?

written-by

Viktória Gyömbér

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

問題

  • ウェブコンテンツが公開されているレイアウトを表示できるようにしてほしいと思っています

Environment

  • Liferay DXP 7.1

解決策

  • 以下のgroovyスクリプトがあり、サーバー管理 -> スクリプト -> 言語 -> Groovyから実行することができます。 このサンプルクエリは、1つのウェブコンテンツのジャーナル記事のロケーションを評価するものであることに注意することが重要である。"YOUR_ARTICLE_ID"'YOUR_ARTICLE_ID'は、問題のウェブコンテンツの記事のIDに置き換える必要があります。
    import com.liferay.portal.model.Layout;
    import com.liferay.portal.service.LayoutLocalServiceUtil;
    import com.liferay.portlet.journal.model.JournalContentSearch;
    import com.liferay.portlet.journal.service.JournalContentSearchLocalServiceUtil;

    String articleId = "YOUR_ARTICLE_ID";

    List<JournalContentSearch> journalContentSearches =
    JournalContentSearchLocalServiceUtil.getArticleContentSearches(articleId);

    List<Layout> layouts = new ArrayList<Layout>();

    for (JournalContentSearch journalContentSearch : journalContentSearches) {
    Layout layout = LayoutLocalServiceUtil.getLayout(
    journalContentSearch.getGroupId(), journalContentSearch.getPrivateLayout(),
    journalContentSearch.getLayoutId());

    layouts.add(layout);
    }

    println(layouts);

    このサンプルクエリは、ご自身の判断で慎重に検討し、テストする必要があります。

did-this-article-resolve-your-issue

legacy-knowledge-base