Message Boards

PortletPreferences in DLPortlet don't work

Jordi Martinez, modified 3 Years ago.

PortletPreferences in DLPortlet don't work

New Member Posts: 5 Join Date: 1/24/20 Recent Posts

Hello everyone.

I need to do a webcontent where the user can add accordions, and inisde of them, point to a concrete folder in the Documents and Media portlet.

I've made an structure (where we have the accordion title and the folder id we want to show), article definition and template.

Inside the template, I want to loop all the elements added in the webcontent, and for each of them, define an accordion entry and the documents and media portlet with the folder the user set, already opened.

To do that, I've defined the preference map:

 

<#assign preferencesMap = freeMarkerPortletPreferences.getPreferences({
                    "portletSetupPortletDecoratorId": "barebone",
                    "rootFolderId" : "${elem.FolderRoute.getData()}",
                    "showFoldersSearch" : "false",
                    "enableRatings" : "false",
                    "portletSetupUseCustomTitle" : "false",
}) />

 

Then, I add this:

 

 <@liferay_portlet["runtime"]
                           defaultPreferences="${preferencesMap}"
                           portletProviderAction=portletProviderAction.VIEW
                          portletName="com_liferay_document_library_web_portlet_DLPortlet"
                       />

 

When I launch this, I see the accordions, with the title I've set, and I also see the DL portlet... but without my preferences (no folder open, no barebone decoration...). To test, I've also defined the "preferencesMap" variable to only "test" text and the code executes with the same results, so seems that the portletpreferences are ignored to the DLPortlet.

Do you have any idea of what is happening? Or can you give me an alternate solution? (I've also tested with <liferay-portlet:runtime> tag, and set the defaultpreferences there... but then the portlet didn't show).

Thank you in advance!