Iniciativas - CAOs
Inicativas
An error occurred while processing the template.
The following has evaluated to null or missing: ==> fieldName.getValue().getString(locale) [in template "20097#20123#739135" at line 44, column 32] ---- 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 legenda = fieldName.getValue(... [in template "20097#20123#739135" at line 44, column 15] ----
1<#assign dlService=serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService")>
2<#assign ddmFieldLocalService=serviceLocator.findService("com.liferay.dynamic.data.mapping.service.DDMFieldLocalService") />
3
4<div class="container">
5 <#if entries?has_content>
6 <div class="row">
7 <#list entries as curEntry>
8 <#if curEntry.getClassName()=="com.liferay.journal.model.JournalArticle">
9 <#assign assetRenderer=curEntry.getAssetRenderer() />
10 <#assign journalArticle=assetRenderer.getAssetObject() />
11 <#assign ddmStructure=journalArticle.getDDMStructure() />
12 <#assign ddmForm=ddmStructure.getDDMForm() />
13 <#assign ddmFormValues=ddmFieldLocalService.getDDMFormValues(ddmForm,
14 journalArticle.getId()) />
15 <#assign ddmFormFieldValues=ddmFormValues.getDDMFormFieldValues() />
16 <#assign imageURL="/documents/" + curEntry.getGroupId() + "/" + curEntry.getEntryId()
17 + "/" />
18 <#assign descr="" />
19 <#assign legenda="" />
20 <#assign jsonObj="" />
21 <#assign viewURL=assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse,
22 curEntry) />
23 <#if assetLinkBehavior !="showFullContent" &&
24 assetRenderer.getURLViewInContext(renderRequest, renderResponse, viewURL)??>
25 <#assign viewURL=assetRenderer.getURLViewInContext(renderRequest, renderResponse,
26 viewURL) />
27 </#if>
28
29 <#list ddmFormFieldValues as fieldName>
30 <#if fieldName.getFieldReference()=='image'>
31 <#assign
32 jsonObj=jsonFactoryUtil.createJSONObject(fieldName.getValue().getString(locale)) />
33
34 <#if jsonObj=="{}">
35 <#assign imgUrl="" />
36 <#else>
37 <#assign imgUrl=jsonObj.url />
38 </#if>
39 </#if>
40 <#if fieldName.getFieldReference()=='desc'>
41 <#assign descr=fieldName.getValue().getString(locale) />
42 </#if>
43 <#if fieldName.getFieldReference()=='legend'>
44 <#assign legenda=fieldName.getValue().getString(locale) />
45 </#if>
46 </#list>
47
48 <div class="col-sm-12 col-xl-6">
49 <div class="iniciativa mb-5">
50 <a href="${viewURL}" class="stretched-link"></a>
51 <div class="bg-card" style="background-image: url(${imgUrl})">
52 <p class="mb-0 legenda">${legenda}</p>
53 </div>
54 <h4 class="weight-bold short-text">${curEntry.getTitle(locale)}</h4>
55 </div>
56 </div>
57 </#if>
58 </#list>
59 </div>
60 </#if>
61</div>
62
63<style>
64
65 .iniciativa .bg-card{
66 position: relative;
67 width: 100%;
68 height: 268px;
69 background-repeat: no-repeat;
70 background-position: center;
71 background-size: cover;
72 border-radius: 8px;
73 margin-bottom: 16px;
74 display: flex;
75 flex-direction: column;
76 justify-content: end;
77 }
78
79 .iniciativa .legenda{
80 background-color: rgba(255,255,255,0.8);
81 text-align: center;
82 }
83</style>