Planned maintenance is scheduled for the week of June 15th - the exact date and time will be announced soon.
See More Details
Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
freeMarkerPortletPreferences has evaluated to null or missing
Hi,i have migrated a custom theme from Liferay 7.0 to Liferay 7.2. The theme deploys without any errors.
In the theme, in portal_normal.ftl i have a runtime portlet (JournalContentPortlet to display an article)
<#assign topBarSection = journalArticleLocalService.getLatestArticleByUrlTitle(themeDisplay.getScopeGroupId(), "top-bar-section", 0)>
<#assign VOID = freeMarkerPortletPreferences.setValue("portletSetupPortletDecoratorId", "borderless") />
<#assign theme_groupID = htmlUtil.escape(theme_display.getCompanyGroupId()?string) />
<#assign VOID = freeMarkerPortletPreferences.setValue("groupId", '${group_id}') />
<#assign VOID = freeMarkerPortletPreferences.setValue("articleId", '${topBarSection.getArticleId()}') />
<@liferay_portlet["runtime"]
defaultPreferences="${freeMarkerPortletPreferences}"
portletProviderAction=portletProviderAction.VIEW
instanceId="topbarcontent"
portletName="com_liferay_journal_content_web_portlet_JournalContentPortlet" />
${freeMarkerPortletPreferences.reset()}
Im using freeMarkerPortletPreferences to set the runtime portlet preferences.
Unfortunatelly i get an exception at the line <#assign VOID = freeMarkerPortletPreferences.setValue("portletSetupPortletDecoratorId", "borderless") />
The following has evaluted to null or missing:
==> freeMarkerPortletPreferences.setValue [in template "mytheme_SERVLET_CONTEXT_/templates/portal_normal.ftl" at line 120, column 24]
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:
freemarker.engine.restricted.classes=
freemarket.engine.restricted.variables=
Does anybody have any idea what might be the problem?
Im using some other freemarker variables also(like ServiceLocator to get a service reference) an they work fine.
In the theme, in portal_normal.ftl i have a runtime portlet (JournalContentPortlet to display an article)
<#assign topBarSection = journalArticleLocalService.getLatestArticleByUrlTitle(themeDisplay.getScopeGroupId(), "top-bar-section", 0)>
<#assign VOID = freeMarkerPortletPreferences.setValue("portletSetupPortletDecoratorId", "borderless") />
<#assign theme_groupID = htmlUtil.escape(theme_display.getCompanyGroupId()?string) />
<#assign VOID = freeMarkerPortletPreferences.setValue("groupId", '${group_id}') />
<#assign VOID = freeMarkerPortletPreferences.setValue("articleId", '${topBarSection.getArticleId()}') />
<@liferay_portlet["runtime"]
defaultPreferences="${freeMarkerPortletPreferences}"
portletProviderAction=portletProviderAction.VIEW
instanceId="topbarcontent"
portletName="com_liferay_journal_content_web_portlet_JournalContentPortlet" />
${freeMarkerPortletPreferences.reset()}
Im using freeMarkerPortletPreferences to set the runtime portlet preferences.
Unfortunatelly i get an exception at the line <#assign VOID = freeMarkerPortletPreferences.setValue("portletSetupPortletDecoratorId", "borderless") />
The following has evaluted to null or missing:
==> freeMarkerPortletPreferences.setValue [in template "mytheme_SERVLET_CONTEXT_/templates/portal_normal.ftl" at line 120, column 24]
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:
freemarker.engine.restricted.classes=
freemarket.engine.restricted.variables=
Does anybody have any idea what might be the problem?
Im using some other freemarker variables also(like ServiceLocator to get a service reference) an they work fine.
i have downloaded the sources and in liferay 7.2, the methods: reset, setValue, setValues has been removed from TemplatePortletPreferences.
So in Liferay 7.2 you should use freeMarkerPortletPreferences .getProperties(propertiesMap) , where propertiesMap is Map<String,Object>
So in Liferay 7.2 you should use freeMarkerPortletPreferences .getProperties(propertiesMap) , where propertiesMap is Map<String,Object>
Estoy migrando un tema a las 7.2 y llevo tiempo comprenderlo, se resuelve de la siguiente manera:
SOLUCION
<#assign
freeMarkerPortletPreferences = freeMarkerPortletPreferences.getPreferences({
"portletSetupPortletDecoratorId": "barebone",
"groupId":theme_display.getCompanyGroupId()?string,,
"articleId": ''
})
/>
<@liferay_portlet["runtime"]
defaultPreferences="${freeMarkerPortletPreferences}"
portletProviderAction=portletProviderAction.VIEW
instanceId="modalfacebookdos"
portletName="com_liferay_journal_content_web_portlet_JournalContentPortlet"
/>
Metodo RESET ya no es necesario para la version 7.2
Community
Company
Feedback