Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-103229

Liferay template-editor generates invalid Freemarker code for embedded repeatable fields

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 7.0.X, 7.1.X, 7.2.X, Master
    • Fix Version/s: 7.2.X, Master
    • Component/s: WCM
    • Labels:

      Description

      Reproduction steps:

      1. Start latest master bundle
      2. Create a structure named "struct1"
      3. Add a Separator to the structure
      4. Add a Text field embedded into the Separator
      5. Make the Text field repeatable
      6. Add a template to "struct1"
      7. Click on the Text field on the left, and its pattern will be inserted into the template
      8. Save it and create a web content from "struct1"
      9. Add 3 values to the repeatable Text field, save the content
      10. Preview the content (eye icon in the "Default Template" section)

      Actual result: an error is shown

      An error occurred while processing the template.
      Syntax error in template "20095#20122#34641" in line 2, column 73:
      Encountered ".", but was expecting:
          ">"
      1<#if Separatordtf8.Textaoqa.getSiblings()?has_content> 
      2	<#list Separatordtf8.Textaoqa.getSiblings() as cur_Separatordtf8.Textaoqa> 
      3		${cur_Separatordtf8.Textaoqa.getData()} 
      4	</#list> 
      5</#if> 
      

      Expected: the values of repeatable Text field should be shown correctly. E.g.:

      Text1 Text2 Text3
      

      This is the generated FTL template:

      <#if Separatordtf8.Textaoqa.getSiblings()?has_content>
      	<#list Separatordtf8.Textaoqa.getSiblings() as cur_Separatordtf8.Textaoqa>
      		${cur_Separatordtf8.Textaoqa.getData()}
      	</#list>
      </#if>
      

      When the variable name doesn't contain "." character, it should look like this:

      <#if Separatordtf8.Textaoqa.getSiblings()?has_content>
      	<#list Separatordtf8.Textaoqa.getSiblings() as cur_Separatordtf8_Textaoqa>
      		${cur_Separatordtf8_Textaoqa.getData()}
      	</#list>
      </#if>
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                yang.cao Yang Cao
                Reporter:
                vendel.toreki Vendel Töreki
                Participants of an Issue:
                Recent user:
                Enterprise Release HU
                Engineering Assignee:
                Vendel Töreki
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  3 weeks, 1 day ago

                  Packages

                  Version Package
                  7.2.X
                  Master