freeMarkerPortletPreferences has evaluated to null or missingfreeMarkerPortletPreferences has evaluated to null or missinghttps://liferay.dev/c/message_boards/find_thread?p_l_id=119785333&threadId=1148051462024-03-29T09:35:22Z2024-03-29T09:35:22ZRE: freeMarkerPortletPreferences has evaluated to null or missingLuis Guzmanhttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1215223532022-09-26T15:49:25Z2022-09-26T00:37:11Z<p>Estoy migrando un tema a las 7.2 y llevo tiempo comprenderlo, se
resuelve de la siguiente manera:</p>
<p>
<strong>SOLUCION</strong></p>
<p><#assign</p>
<p> freeMarkerPortletPreferences = freeMarkerPortletPreferences.getPreferences({</p>
<p> "portletSetupPortletDecoratorId": "barebone",</p>
<p> "groupId":theme_display.getCompanyGroupId()?string,,</p>
<p> "articleId": ''</p>
<p> })</p>
<p>/></p>
<p> </p>
<p><@liferay_portlet["runtime"]</p>
<p> defaultPreferences="${freeMarkerPortletPreferences}"</p>
<p> portletProviderAction=portletProviderAction.VIEW</p>
<p> instanceId="modalfacebookdos"</p>
<p> portletName="com_liferay_journal_content_web_portlet_JournalContentPortlet"</p>
<p>/></p>
<p> </p>
<p>
<em>Metodo <strong>RESET </strong>ya no es necesario para la version 7.2 </em></p>Luis Guzman2022-09-26T00:37:11ZRE: freeMarkerPortletPreferences has evaluated to null or missingJacek Kozielhttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1148102942019-08-20T09:35:59Z2019-08-20T09:35:59Zi have downloaded the sources and in liferay 7.2, the methods: reset, setValue, setValues has been removed from TemplatePortletPreferences.<br />So in Liferay 7.2 you should use freeMarkerPortletPreferences .getProperties(propertiesMap) , where propertiesMap is Map<String,Object>Jacek Koziel2019-08-20T09:35:59ZfreeMarkerPortletPreferences has evaluated to null or missingJacek Kozielhttps://liferay.dev/c/message_boards/find_message?p_l_id=119785333&messageId=1148051452019-08-19T16:22:47Z2019-08-19T16:22:47ZHi,i have migrated a custom theme from Liferay 7.0 to Liferay 7.2. The theme deploys without any errors.<br />In the theme, in portal_normal.ftl i have a runtime portlet (JournalContentPortlet to display an article)<br /><br /> <#assign topBarSection = journalArticleLocalService.getLatestArticleByUrlTitle(themeDisplay.getScopeGroupId(), "top-bar-section", 0)><br /> <#assign VOID = freeMarkerPortletPreferences.setValue("portletSetupPortletDecoratorId", "borderless") /><br /> <#assign theme_groupID = htmlUtil.escape(theme_display.getCompanyGroupId()?string) /><br /> <#assign VOID = freeMarkerPortletPreferences.setValue("groupId", '${group_id}') /><br /> <#assign VOID = freeMarkerPortletPreferences.setValue("articleId", '${topBarSection.getArticleId()}') /><br /> <@liferay_portlet["runtime"]<br /> defaultPreferences="${freeMarkerPortletPreferences}"<br /> portletProviderAction=portletProviderAction.VIEW<br /> instanceId="topbarcontent"<br /> portletName="com_liferay_journal_content_web_portlet_JournalContentPortlet" /><br /> ${freeMarkerPortletPreferences.reset()}<br /><br />Im using freeMarkerPortletPreferences to set the runtime portlet preferences.<br />Unfortunatelly i get an exception at the line <#assign VOID = freeMarkerPortletPreferences.setValue("portletSetupPortletDecoratorId", "borderless") /><br /><strong>The following has evaluted to null or missing:<br />==> freeMarkerPortletPreferences.setValue [in template "mytheme_SERVLET_CONTEXT_/templates/portal_normal.ftl" at line 120, column 24]</strong><br /><br />It did work in the Liferay 7.0 CE. Now it seems like the freeMarkerPortletPreferences variable is null, so running a setter causes an exception. In portal-ext.properties i have:<br />freemarker.engine.restricted.classes=<br />freemarket.engine.restricted.variables=<br /><br />Does anybody have any idea what might be the problem?<br />Im using some other freemarker variables also(like ServiceLocator to get a service reference) an they