S'ha produït un error mentre es processava la plantilla.
The following has evaluated to null or missing:
==> button_obj.classPK [in template "20116#20152#695946" at line 84, column 48]
----
Tip: It's the step after the last dot that caused this error, not those before it.
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #assign classPK = button_obj.classPK [in template "20116#20152#695946" at line 84, column 29]
----
1<#-- $Id: NOTICIA.ftl 2736 2021-12-02 17:23:49Z patricia.hevia $ -->
2<#assign companyId = themeDisplay['companyId'] />
3<#assign layoutService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService") />
4<#assign JournalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService")>
5<#assign journalArticleResourceLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleResourceLocalService")>
6<#assign assetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService")>
7<#assign assetTagLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetTagLocalService")>
8<#assign DLAppLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLAppLocalService")>
9
10<#if entries?has_content>
11 <ul class="news-list list-unstyled">
12 <#list entries as curEntry>
13
14 <#if curEntry.getClassName() == "com.liferay.journal.model.JournalArticle">
15 <#assign assetRenderer = curEntry.getAssetRenderer()/>
16 <#assign journalArticle = assetRenderer.getAssetObject() />
17 <#assign document = saxReaderUtil.read(journalArticle.getContent())>
18 <#assign rootElement = document.getRootElement()>
19 <#assign defaultLanguageId = parseXml ("@default-locale", rootElement)>
20
21 <#-- assign content values to variables -->
22 <#assign newsImage = getField("newsImage", locale, defaultLanguageId, rootElement)!>
23 <#assign newsImageAlt = getFieldAttribute("alt","newsImage", locale,
24 defaultLanguageId, rootElement)!>
25 <#assign newsTitle = getField("newsTitle", locale, defaultLanguageId, rootElement)!>
26 <#assign newsDate = getField("newsDate", locale, defaultLanguageId, rootElement)!>
27 <#if newsDate?? && newsDate != "">
28 <#assign displaydate = newsDate?datetime("yyyy-MM-dd")>
29 </#if>
30 <#assign newsSummary = getField("newsSummary", locale, defaultLanguageId, rootElement)!>
31 <#assign buttonWebContent = getField("buttonWebContent", locale, defaultLanguageId, rootElement)!>
32
33 <#assign layoutUuid = journalArticle.layoutUuid />
34 <#assign layoutURL = journalArticle.urlTitle />
35 <#assign layoutObject = layoutService.getLayoutsByUuidAndCompanyId(layoutUuid, companyId) />
36 <#assign articleId = journalArticle.articleId>
37
38 <#assign articleResourcePK = journalArticle.getResourcePrimKey()/>
39 <#assign categoryList=assetCategoryLocalService.getCategories("com.liferay.journal.model.JournalArticle",articleResourcePK) >
40 <#assign tagList=assetTagLocalService.getTags("com.liferay.journal.model.JournalArticle",articleResourcePK) >
41
42 <#assign categoryURL = "">
43 <#if categoryList?has_content>
44 <#assign categoryURL = "&p_r_p_categoryId="+categoryList[0].categoryId >
45 </#if>
46
47 <#assign tagURL = "">
48 <#if tagList?has_content>
49 <#assign tagURL = "&p_r_p_tag="+tagList[0].name >
50 </#if>
51
52 <#-- Create url to view -->
53 <#assign viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, curEntry,true)/>
54 <#-- Remove param redirect -->
55 <#assign pos = viewURL?index_of("?")/>
56 <#assign valueViewURL = viewURL?substring(0,pos)/>
57
58 <li class="news-item row" tabindex="0" title="<@liferay.language key="news.accessibility.view.more" /> ${newsTitle}" aria-label="<@liferay.language key="news.accessibility.view.more" /> ${newsTitle}" onclick="location.href='${valueViewURL}'">
59
60 <div class="col-12 col-md-3 news-image">
61 <#if newsImage?? && newsImage != "">
62 <#assign imageJson = newsImage?eval />
63 <#assign viewUrl = themeDisplay.getPortalURL() + themeDisplay.getPathContext() + "/documents/" + imageJson.groupId?number + "/" + imageJson.uuid />
64 <#if newsImageAlt?? && newsImageAlt != "">
65 <img alt="${newsImageAlt.data}" src="${viewUrl}" />
66 <#else>
67 <img alt="" src="${viewUrl}" />
68 </#if>
69 </#if>
70 </div>
71 <div class="col-12 col-md-8 news-content">
72 <h3 class="news-title">
73 ${newsTitle}
74 </h3>
75 <#if displaydate??>
76 <p class="news-date">${displaydate?string["dd/MM/yyyy"]}</p>
77 </#if>
78 <div class="summary">${newsSummary}</div>
79
80 </div>
81 <div class="news-button">
82 <#if buttonWebContent?? && buttonWebContent != "">
83 <#assign button_obj = buttonWebContent?eval>
84 <#assign classPK = button_obj.classPK>
85 <#assign embeddedJournalArticleButton = JournalArticleLocalService.getLatestArticle(classPK?number)>
86 <#-- Display content with its own defined template -->
87 <a title="<@liferay.language key="news.accessibility.view.more" /> ${newsTitle}" aria-label="<@liferay.language key="news.accessibility.view.more" /> ${newsTitle}" href="${valueViewURL}">
88 <@liferay_journal["journal-article"]
89 articleId=embeddedJournalArticleButton.getArticleId()
90 ddmTemplateKey=embeddedJournalArticleButton.getDDMTemplateKey()
91 groupId=embeddedJournalArticleButton.getGroupId()
92 />
93 </a>
94 </#if>
95 </div>
96 </li>
97 </#if>
98 </#list>
99 </ul>
100</#if>
101
102<#function getField field languageId defaultLanguageId xml>
103 <#local defaultSelector = "//dynamic-content[@language-id='" + defaultLanguageId + "' and ancestor-or-self::*[@name='" + field + "']]">
104 <#local localeSelector = "//dynamic-content[@language-id='" + languageId + "' and parent::*[@name='" + field + "']]">
105
106 <#local selector = saxReaderUtil.createXPath(localeSelector)>
107 <#local value = selector.selectSingleNode(xml)!>
108
109 <#if value?has_content>
110 <#return value.getText()>
111 </#if>
112
113 <#local selector = saxReaderUtil.createXPath(defaultSelector)>
114 <#local value = selector.selectSingleNode(xml)!>
115
116 <#if value?has_content>
117 <#return value.getText()>
118 </#if>
119
120 <#return "">
121</#function>
122
123<#function getFieldAttribute attribute field languageId defaultLanguageId xml>
124 <#local defaultSelector = "//dynamic-content[@language-id='" + defaultLanguageId + "' and ancestor-or-self::*[@name='" + field + "']]">
125 <#local localeSelector = "//dynamic-content[@language-id='" + languageId + "' and parent::*[@name='" + field + "']]">
126
127 <#local selector = saxReaderUtil.createXPath(localeSelector)>
128 <#local value = selector.selectSingleNode(xml)!>
129
130 <#if value?has_content>
131 <#return value.attribute(attribute)>
132 </#if>
133
134 <#local selector = saxReaderUtil.createXPath(defaultSelector)>
135 <#local value = selector.selectSingleNode(xml)!>
136
137 <#if value?has_content>
138 <#return value.attribute(attribute)>
139 </#if>
140
141 <#return "">
142</#function>
143
144<#function parseXml xpath xml>
145 <#local selector = saxReaderUtil.createXPath(xpath)>
146 <#local result = selector.selectSingleNode(xml)!>
147
148 <#if result?has_content>
149 <#return result.getStringValue()>
150 </#if>
151
152 <#return "">
153</#function>
