-
Type:
Bug
-
Status: Closed
-
Resolution: Won't Fix
-
Affects Version/s: 7.0.0 DXP FP92, 7.2.1 CE GA2, 7.3.4 CE GA5
-
Fix Version/s: None
-
Labels:None
There is an issue with the template editor when creating web content templates with regards to repeatable fields. The ?has_content built in seems to assume that the field is present in the versioned item of content in the database. It might not be.
This is the default code Liferay Template editor gives:
<#if Repeated.getSiblings()?has_content> <#list Repeated.getSiblings() as cur_Repeated> ${cur_Repeated.getData()} </#list> </#if>
This is failing because it assumes the data is there so has_content alone isn't safe. Though to be fair I'm a bad template developer and now I've copied this all over my portal.
This is the code assumes the field is not there, so template doesn't error
<#if (Repeated.getSiblings())?? && Repeated.getSiblings()?has_content> <#list Repeated.getSiblings() as cur_Repeated> ${cur_Repeated.getData()} </#list> </#if>
Could the template editor be updated accordingly making sure to have brackets around the exists builtin. (Repeated.getSiblings())??