Where is the option to view the layout where the web content is published?

Issue

  • We are looking for a possibility to view the layout where the web content is published

 

Environment

  • Liferay DXP 7.1

 

Resolution

  • There is the following groovy script which can be executed via Server Administration -> Scripts -> Language -> Groovy. It is important to note that this sample query assesses one web content journal article’s location(s)."YOUR_ARTICLE_ID"and'YOUR_ARTICLE_ID'should be replaced with ID of the web content article in question.
    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);

    This sample query should be carefully reviewed and tested at your own discretion. 

 

 

この記事は役に立ちましたか?
0人中0人がこの記事が役に立ったと言っています