Liferay 7 Asset publisher new web content folder

liferay asset publisher
asset publisher solidworks
portal in liferay

I've two web content structures (foo and bar) in Liferay 7.0 and I want to store the web contents inside webcontents folders (webcontents/foo and webcontents/bar). I added two asset publishers, one for each structure, and I also allow the user to create new webcontents through the asset publisher plus '+' icon. However, they are created in the web content root folder (webcontents/). There is any way to dynamicaly save the webcontent that are created through the '+' icon in the asset publisher to a specific folder (based on the template itself, tags, or any other field)?

I used a "ModelListener" for this exact scenario. https://dev.liferay.com/de/develop/tutorials/-/knowledge_base/7-0/model-listeners

If you extend Liferays BaseModelListener you can use the onBeforeCreate() Method for example. First check the ddmStructure of the current journalArticle and get or create your Folder. Now set the Folder ID for your journalArticle and your done!

Using the Asset Publisher – Liferay Help Center, By default, the Asset Publisher portlet is scoped to the site of the After you've added a scope, a new Select button appears under the Asset Entries heading. Wiki Page; Document; Web Content Folder. To use this feature, add or edit a web content article that the Asset Publisher should display. Before clicking Publish, click on Abstracts, flag Small Image, and upload an image. Then click Publish. Once your web content article appears in the Asset Publisher’s list, clicking the small image takes you to the full article.

I don't think that this can be achieved without customization.

I'd create a service wrapper to determine the Folder e.g. by the Structure's name.

Publishing Basic Web Content – Liferay Help Center, You'll see a folder structure containing all of the web content articles that exist in the Click Add → Basic Web Content to create a new web content article. In Liferay DXP 7.0, web content types are no longer used and have been replaced by This prevents it from appearing in search results or in the Asset Publisher. Use the Asset Publisher. Insert them in an asset like a web content article or blog entry. Here, you’ll learn to use the Media Gallery. Using the Media Gallery. The Media Gallery publishes your media files in a simple gallery-like style. It shows a large thumbnail of each media file, lets the user download files, and has slideshow capabilities.

Posting the code as solution suggested by @Viergelenker

public class ArticleSetListenerPortlet extends BaseModelListener<JournalArticle> {

    private static final Log LOGGER = LogFactoryUtil.getLog(ArticleSetListenerPortlet.class);

    @Override
    public void onBeforeCreate(JournalArticle model) throws ModelListenerException {
            String structureName = model.getDDMStructure().getName(Locale.US);
            long groupId = xxxxx;
            List<JournalFolder> journalFolders = JournalFolderLocalServiceUtil.getFolders(groupId);
            for(JournalFolder folder : journalFolders) {

                if("Foo".equals(folder.getName())) {
                        model.setFolderId(folder.getFolderId());
                        LOGGER.info("Set folder as Foo");
                    }

         }


            super.onBeforeCreate(model);

    }

Publishing Assets – Liferay Help Center, As you create web content, it's important to keep in mind that to Liferay DXP, You can use the Asset Publisher to publish a mixed group of various kinds of After you've added a scope, a new Select button appears under the Asset Entries heading. Boards Message; Basic Web Content; Web Content Folder; Wiki Page. In the guestbook-web module project, create a new folder called asset under the resources/META-INF/resources folder. Add two folders to this new folder: entry and guestbook. Create a new file called full_content.jsp in the /asset/guestbook folder. This JSP displays a guestbook asset’s full content. Add the following code to this file:

Liferay 7 Asset publisher new web content folder, I used a "ModelListener" for this exact scenario. https://dev.liferay.com/de/develop​/tutorials/-/knowledge_base/7-0/model-listeners. If you extend  Admin creates a Web Content. Admin displays the Web Content somewhere on the site (in the given example, within an Asset Publisher). Admin would like this Web Content to be updated, but not immediately - therefore schedules it by a Display Date set to a future time. By pressing the Publish button, a new version of the Web Content is created.

Publishing Typed Content With Liferay DXP Asset Publisher, This article is a step-by-step guide to utilizing the Asset Publisher to publish typed content. When adding one-off web content to a page in Liferay, it probably makes Navigate into your new Staff Members folder and click Add > Staff Content with Tags and Categories in the Liferay 7 Knowledge Base  To help you better understand the proposal, throughout the description we will make use of a practical example: the UI of a Liferay T-shirt shop built with Asset Publisher and web content. Our items (cool Liferay tees) consist on a title, a description, a price and a high-resolution image available in our file respository.

[PDF] Liferay Training, Adding a new Web Content Display portlet . Setting up the Asset Publisher portlet to display a News list – Advanced Users only . Step 2: In the Manage page screen, select the folder / parent page you want your child 7. 6. Editing standard Web Content Display portlets. To edit a standard Web Content Display portlet  Figure 1: Selecting assets in the Asset Publisher manually is similar to selecting assets in the Web Content Display application except that you can select assets of any type, not just web content. You can also add scopes to expand the list of assets that are available to be displayed in the Asset Publisher.

Comments
  • It would be nice to explain a bit and add some relevant code, if the link becomes unavailable.
  • the link is the official documentation. the answer can be without code, saying "you need to perform a customization". In LR 6.2 it would be called Hook, in 7.0 we have a service wrapper. Is an overwrite of LR default behavior. I will keep this question open in order to see any other opinion regarding configurations.
  • Thanks for your addition! Just one minor improvement to hopefully reduce runtime: JournalFolder folder = JournalFolderLocalServiceUtil.fetchFolder( groupId, title ); Not sure about the implementation, but this should do a database query and you won't need a for-loop :)
  • I understand. But in my case, I do have several folders so I need the for :)