Skip to content

Commit

Permalink
[BUGFIX] Sheets in BE Preview
Browse files Browse the repository at this point in the history
Better support for sheets with subcontent

Resolves: #545
Release: 12.0.1
  • Loading branch information
opi99 committed Feb 28, 2024
1 parent 276dcf2 commit 13c8d0f
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<f:for as="childNodesPerSheet" each="{node.childNodes}" key="sheetKey">
<f:if condition="{childNodesPerSheet.lDEF}">
<f:if condition="{node.rendering.beLayout}">
<f:then>
<f:if condition="{node.rendering.beLayout}">
<f:then>
<f:for as="childNodesPerSheet" each="{node.childNodes}" key="sheetKey">
<f:if condition="{childNodesPerSheet.lDEF}">
<f:if condition="{node.rendering.beLayoutDesign}">
<f:then>
<f:render partial="Backend/Handler/DoktypeDefaultHandler/Node/ChildsDesign" section="renderChildElements" arguments="{fieldConfig: '{node.datastructure.sheets.{sheetKey}.ROOT.el}', childElements: '{childNodesPerSheet.lDEF}', childFlexformData: '{node.flexform.data.{sheetKey}.lDEF}', parentPointer: '{node.raw.table}:{node.raw.entity.uid}:{sheetKey}:lDEF:', node: node}" />
Expand All @@ -14,10 +14,33 @@
/>
</f:else>
</f:if>
</f:then>
<f:else>
<f:render partial="Backend/Handler/DoktypeDefaultHandler/Node/ChildsTable" section="renderChildElements" arguments="{fieldConfig: '{node.datastructure.sheets.{sheetKey}.ROOT.el}', childElements: '{childNodesPerSheet.lDEF}', childFlexformData: '{node.flexform.data.{sheetKey}.lDEF}', parentPointer: '{node.raw.table}:{node.raw.entity.uid}:{sheetKey}:lDEF:', subpart: 'CHILD'}" />
</f:else>
</f:if>
</f:if>
</f:for>
</f:if>
</f:for>
</f:then>
<f:else>
<div class="row">
<f:variable name="count">0</f:variable>
<f:for as="childNodesPerSheet" each="{node.childNodes}" key="sheetKey">
<f:if condition="{childNodesPerSheet.lDEF}">
<f:variable name="count">{count + 1}</f:variable>
</f:if>
</f:for>
<f:switch expression="{count}">
<f:case value="1">{f:variable(name: 'colwidthclass', value: 'col col-lg-12')}</f:case>
<f:case value="2">{f:variable(name: 'colwidthclass', value: 'col col-lg-6')}</f:case>
<f:case value="3">{f:variable(name: 'colwidthclass', value: 'col col-lg-4')}</f:case>
<f:case value="4">{f:variable(name: 'colwidthclass', value: 'col col-lg-3')}</f:case>
<f:case value="6">{f:variable(name: 'colwidthclass', value: 'col col-lg-2')}</f:case>
<f:defaultCase>{f:variable(name: 'colwidthclass', value: 'col')}</f:defaultCase>
</f:switch>
<f:for as="childNodesPerSheet" each="{node.childNodes}" key="sheetKey">
<f:if condition="{childNodesPerSheet.lDEF}">
<div class="{colwidthclass}">
<f:render partial="Backend/Handler/DoktypeDefaultHandler/Node/ChildsTable" section="renderChildElements" arguments="{fieldConfig: '{node.datastructure.sheets.{sheetKey}.ROOT.el}', childElements: '{childNodesPerSheet.lDEF}', childFlexformData: '{node.flexform.data.{sheetKey}.lDEF}', parentPointer: '{node.raw.table}:{node.raw.entity.uid}:{sheetKey}:lDEF:', subpart: 'CHILD'}" />
</div>
</f:if>
</f:for>
</div>
</f:else>
</f:if>

Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@
<tvp:format.stripTags whitespace="true">{childFlexformData.{fieldKey}.vDEF}</tvp:format.stripTags>
</tvp:format.wordLength>
</f:format.crop><br/>
</f:then>>
</f:then>
</f:if>
</f:for>
</f:section>

<f:section name="renderChildElements">
<f:for each="{fieldConfig}" key="fieldKey" as="subFieldConfig">
<f:variable name="layoutKey">{subFieldConfig.config.foreign_table}{subFieldConfig.config.allowed}.{fieldKey}</f:variable>
<f:variable name="layoutKey">NoField.{fieldKey}</f:variable>
<f:if condition="{subFieldConfig.config.foreign_table} || {subFieldConfig.config.allowed}">
<f:variable name="layoutKey">{subFieldConfig.config.foreign_table}{subFieldConfig.config.allowed}.{fieldKey}</f:variable>
</f:if>
<f:if condition="{childElements.{fieldKey}}">
<tvp:arrayVariable name="layoutHeaders" key="{layoutKey}">
<strong>
Expand Down Expand Up @@ -72,6 +75,14 @@
</f:then>
<f:else>
<f:variable name="subFlexFormData" value="{childFlexformData.{fieldKey}.el}" />
<tvp:arrayVariable name="layoutHeaders" key="{layoutKey}">
<strong>
<f:if condition="{subFieldConfig.label}">
<f:translate key="{subFieldConfig.label}" default="{subFieldConfig.label}" />
</f:if>
</strong>
</tvp:arrayVariable>

<tvp:arrayVariable name="layoutFields" key="{layoutKey}">
<f:render section="renderChildElements" arguments="{fieldConfig: subFieldConfig.el, childElements: '{childElements.{fieldKey}}', childFlexformData: '{childFlexformData.{fieldKey}.el}', beLayout: beLayout, parentPointer: '{parentPointer}#{fieldKey}#el', subpart: '{subpart}.{fieldKey}'}" />
<f:render section="renderSubFields" arguments="{fieldConfig: subFieldConfig.el, childElements: '{childElements.{fieldKey}}', childFlexformData: '{childFlexformData.{fieldKey}.el}'}" />
Expand Down

0 comments on commit 13c8d0f

Please sign in to comment.