Fluid icon indicating copy to clipboard operation
Fluid copied to clipboard

Add {array} to give the possibility to get an empty array

Open garbast opened this issue 5 months ago • 1 comments

In a template I want to start a variable with an empty array to fill it later on with f:merge.

<f:variable name="filteredItems" value="{array}"/>
<f:for each="{allItems}" as="item">
    <f:if condition="{item.uid} > 10">
      <f:variable name="filteredItems" value="{f:merge(a: filteredItems, b: {item.uid: item})"/>
    </f:if>
</f:for>

garbast avatar Aug 09 '25 07:08 garbast

We should evaluate if it's at all feasible to change the RegEx to allow {} as empty array syntax. Since this only affects the inline syntax within ViewHelpers, this might be possible without major syntax conflicts.

s2b avatar Aug 11 '25 11:08 s2b